Zend OSX, and a "." added to context path - macos

I downloaded and unpacked the latest version of Zend Framework, onto OSX (10.6) (am also running webserver with XAMPP, but I added the include_path change to both XAMPP and OSX path, but this is all command line so I dont think the php compiler is using the XAMPP install)
I try to create a project and get the following: (note that i am replacing part of the path with "----" just for the purpose of privacy)
sh-3.2# zf create project
testProject
Fatal error: Uncaught exception
'Zend_Exception' with message 'File "Zend/Tool/Project/Context/Zf/./AbstractClassFile.php" does not exist or class "Zend_Tool_Project_Context_Zf_._AbstractClassFile" was not found in the file' in /Volumes/----/----/z/library/Zend/Loader.php:99 Stack trace:
0 /Volumes/----/----/z/library/Zend/Tool/Project/Context/Repository.php(88):
Zend_Loader::loadClass('Zend_Tool_Proje...')
1 /Volumes/----/----/z/library/Zend/Tool/Project/Context/Repository.php(79):
Zend_Tool_Project_Context_Repository->addContextClass('Zend_Tool_Proje...')
2 /Volumes/----/----/z/library/Zend/Tool/Project/Provider/Abstract.php(87):
Zend_Tool_Project_Context_Repository->addContextsFromDirectory('/Volumes/----/...',
'Zend_Tool_Proje...')
3 /Volumes/----/----/z/library/Zend/Tool/Framework/Provider/Repository.php(187):
Zend_Tool_Project_Provider_Abstract->initialize()
4 /Volumes/----/----/z/library/Zend/Tool/Framework/Client/Abstract.php(128):
Zend_Tool_F in
/Volumes/----/----/z/library/Zend/Loader.php
on line 99 sh-3.2#
Note the period after "Context_Zf_"
I've narrowed it down to this block of code:
File: /Volumes/----/----/z/library/Zend/Tool/Project/Provider/Abstract.php
public function initialize()
{
// initialize the ZF Contexts (only once per php request)
if (!self::$_isInitialized) {
// load all base contexts ONCE
$contextRegistry = Zend_Tool_Project_Context_Repository::getInstance();
$contextRegistry->addContextsFromDirectory(
dirname(dirname(__FILE__)) . '/Context/Zf/', 'Zend_Tool_Project_Context_Zf_'
);
$contextRegistry->addContextsFromDirectory(
dirname(dirname(__FILE__)) . '/Context/Filesystem/', 'Zend_Tool_Project_Context_Filesystem_'
);
// determine if there are project specfic providers ONCE
Specifically "dirname(dirname(FILE))" is echoing as "."
if I wrap the block with an 'if (dirname(dirname(__FILE))!=".") { … } ', then I don't get that error, but I get another:
sh-3.2# zf create project testProject
An Error Has Occurred
Context by name applicationDirectory does not exist in the registry.
Zend Framework Command Line Console
Tool v1.11.3 Details for action
"Create" and provider "Project"
Project
zf create project path name-of-profile file-of-profile

I tested on my Mac and it works fine. Have you tried to restart you xampp server, I don't really know how it works as I use Apache & PHP already installed versions not a "AMP pack". Maybe it's a problem with the php.ini include_path which has not been reloaded.
It's clearly a problem with the path as it don't succeed to build the class name :
"Zend/Tool/Project/Context/Zf/./AbstractClassFile.php"
the dot should not appear here.
Can you share you PATH variable from the terminal and your include_path from your php.ini.

Sadly the solution was to install zend server community edition, and have that take care of everything for me. For anyone else on OSX going this route, check out: http://cmorrell.com/webdev/installing-zend-server-zend-framework-on-os-x-291
includes the steps for enabling CLI support.

Related

Joomla "Fatal error: Cannot redeclare jblogerror() in on line 0"

Here is a weird problem i'm facing; after updating Joomla to the latest version, website failed to up load but, as i've made a backup manually from these folders:
administrator
bin
cli
components
includes
layouts
libraries
modules
plugins
yt-assets
and all the root files, after restoring the backup still the website is not loading and just says
"Fatal error: Cannot redeclare jblogerror() in on line 0" !
Any suggestion? Thank you.
Apparently, the version of jBlog you are using is loading its attempting to load its own classes twice.
Let's assume the jBlog developers already fixed it and you carelessly ignored the warning to ensure all your extensions are compatible before updating.
Are you able to access administrator? Simply go there and upgrade jBlog including any modules.
Else, the issue lies within a plugin. In order to access the administrator and perform the update, you will need to manually disable the offending plugin.
A simple way is to rename its folder: start from plugins/system then plugins/content hopefully you'll have spotted it by then. Look into the subfolders of each and spot any that may be relevant to jBlog (or grep through the folder to locate the specific string)
If you have console access, simply run
# grep -rl jblogerror plugins/system
and you should see all the files that include such string, just rename their main plugin folder. But you could also do all this through ftp and guessing.

candc:could not open model configuration file for reading:models/config

I installed boxer, tool from C&C to convert CCG to DRS, from http://svn.ask.it.usyd.edu.au/trac/candc/wiki/Installation
System - Windows 7 (64 bit)
But then after installing I am getting following error:
C:\Users\abcd\Documents\candc-1.00\bin>candc.exe --models models
candc:could not open model configuration file for reading:models/config
I did check http://svn.ask.it.usyd.edu.au/trac/candc/wiki/FAQ and I have an empty config file in models directory . But still it doesnt work
Please help me to solve the problem
You are accessing models directory from within the bin directory.
Execute the same command from outside bin .
Try
bin\candc.exe --models models
It should work fine now

Django app in Eclipse won't run after upgrade to django 1.4

After upgrading to Django 1.4, I now get the following error message:
raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
ImportError: Could not import settings 'settings.py' (Is it on sys.path?): No module named py
I read that it might have something to do with pydev 2.4 eg: here, so I upgraded pydev to the latest version, 2.5. I am using eclipse indigo.
I started to have a look at the run cnofiguration, and noticed that the django 1.3 egg was still being referenced. So I went to windows/preferences/pydev/interpreter-python, and the 1.3 egg was being referenced in the system PYTHON path.
To try and correct this, I removed the existing python interpreter, and re-added a new one. My python is run from venv, so I added this. An error comes up:
I don't think this is related, but I can see that /venv/lib has appears in the System PYTHONPATH list, whereas in Windows the folder is called /venv/Lib, so I added this as well. Still the new django egg hasn't been include, so I manually added this under the 'Libraries' window.
However, I'm still receiving the error message.
The app runs fine from the command line.
Figured this out after a few hours of trying different things.
I created a new Django project using the pydev 2.5 just to see what would happen, and I noticed that the 'django settings module' entry (see below) was appname.settings. Previously I had put 'settings.py'. I removed the entry entirely, which cleared up the first problem.
After this I was getting a 'module appname not found' error, so I tried putting an empty __init__.py file in the root of my app, which seemed to work.
In a virtualenv, this is usually the case where you forgot to add the /Lib from the base python install during the install process (so, when searching in the PYTHONPATH it's not finding things such as 'threading.py' or 'traceback.py', etc.
I solved this by adding the following to manage.py:
import os
os.environ['DJANGO_SETTINGS_MODULE'] = '<django_app_folder>.settings'
os.environ['SERVER_NAME'] = '<name_of_server>'
<django_app_folder> is the name of the folder containing the settings.py file.
<name_of_server> needs to be there, but I didn't find that it matters what it's set to.
I had this problem. My project did not have a PyDev - Django property so the other solution here did not work. I think this is because I did not initially create it as a Django project. Instead, what worked was:
right click project > properties > PyDev PYTHONPATH > String substitution variables.
Add a variable named DJANGO_SETTINGS_MODULE Its value should be yourapp.settings (or edit it if it's already there)

How to setup mod_lua in Apache to access third party Lua modules?

I'm attempting to set up mod_lua module for Apache, but have encountered difficulty regarding accessing third party Lua modules. Say I have a hello_world.lua in Apache's htdocs folder that has something like this:
require "apache2"
function handle(r)
r.content_type = "text/html"
r:write "Hello World from <strong>mod_lua</strong>."
return apache2.OK
end
And I go to "http://localhost/hello_world.lua", that will function as expected. But if I try to add a line such as:
require "socket"
Or
require "cgilua"
I get the following output:
Error!
attempt to call a nil value
However, some modules do work, such as:
require "base"
That functions as expected.
If I navigate to base.lua in the filesystem (c:\program files\lua\5.1\lua\base.lua) and remove this file, then attempt to run my script I get the same error as stated above. So this must be the directory that mod_lua is checking for modules. Modules dlls are not in this folder, instead they are in c:\program files\lua\5.1\clibs\, which I set up the environment variable LUA_CPATH to point to.
Luasocket and cgilua are both present in this folder, yet they cause an error when I try to require them in my script.
From what I can gather, it works fine with any pure lua modules, but anything that has cmodules as well (socket, etc) causes problems.
Additional info:
OS: Windows 7 Home Premium
LUA_PATH = c:\program files\lua\5.1\lua\
LUA_CPATH = c:\program files\lua\5.1\clibs\
Apache version: 2.2.22
mod_lua version: http://www.corsix.org/content/mod-lua-win32#comment-3214
What needs to be done to be able to require modules in scripts run by mod_lua?
It looks like you need to add LuaPackageCPath and/or LuaPackagePath directives to your site configuration (in the global configuration file, or .htaccess, ...).
In your case, I'd assume that
LuaPackagePath c:\program files\lua\5.1\lua\
LuaPackageCPath c:\program files\lua\5.1\clibs\
should do the trick.

Call to undefined function mysql_connect [duplicate]

This question already has answers here:
Fatal error: Call to undefined function mysql_connect() in C:\Apache\htdocs\test.php on line 2
(2 answers)
Closed 3 months ago.
I just installed PHP and Apache on my home PC. When I try to call function mysql_connect I get:
fatal error: call to undefined function mysql_connect.
I have loaded php.ini where I have uncommented lines extension=php_mysql.dll and
extension=php_mysqli.dll and changed extension directory to extension_dir = "C:\php\ext" - which is the directory where files php_mysql.dll and php_mysqli.dll are. How can I fix this problem?
Output of phpinfo():
http://jsfiddle.net/MMTwA/
After looking at your phpinfo() output, it appears the mysql extensions are not being loaded. I suspect you might be editing the wrong php.ini file (there might be multiple copies). Make sure you are editing the php file at C:\php\php.ini (also check to make sure there is no second copy in C:\Windows).
Also, you should check your Apache logs for errors (should be in the \logs\ directory in your Apache install.
If you haven't read the below, I would take a look at the comments section, because it seems like a lot of people experience quirks with setting this up. A few commenters offer solutions they used to get it working.
http://php.net/manual/en/install.windows.extensions.php
Another common solution seems to be to copy libmysql.dll and php_mysql.dll from c:\PHP to C:\Windows\System32.
Background about my (similar) problem:
I was asked to fix a PHP project, which made use of short tags. My WAMP server's PHP.ini had short_open_tag = off.
In order to run the project for the first time, I modified this setting to short_open_tag = off.
PROBLEM Surfaced:
Immediately after this change, all my mysql_connect() calls failed. It threw an error
fatal error: call to undefined function mysql_connect.
Solution:
Simply set short_open_tag = off.
My PC is running Windows 7 (Apache 2.2 & PHP 5.2.17 & MySQL 5.0.51a), the syntax in the file "httpd.conf" (C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf\httpd.conf) was sensitive to slashes.
You can check if "php.ini" is read from the right directory. Just type in your browser "localhost/index.php". The code of index.php is the following:
<?php
echo phpinfo();
?>
There is the row (not far from the top) called "Loaded Configuration File". So, if there is nothing added, then the problem could be that your "php.ini" is not read, even you uncommented (extension=php_mysql.dll and extension=php_mysqli.dll). So, in order to make it work I did the following step. I needed to change from
PHPIniDir 'c:\PHP\'
to
PHPIniDir 'c:\PHP'
Pay the attention that the last slash disturbed everything!
Now the row "Loaded Configuration File" gets "C:\PHP\php.ini" after refreshing "localhost/index.php" (before I restarted Apache2.2) as well as mysql block is there. MySQL and PHP are working together!
You have probably forgotten to restart apache/wamp/xamp/whatever webserver you use, you need to do that in order to make it work
Check your php.ini, I'm using Apache2.2 + php 5.3. and I had the same problem and after modify the php.ini in order to set the libraries directory of PHP, it worked correctly. The problem is the default extension_dir configuration value.
The default (and WRONG) value for my work enviroment is
; extension_dir="ext"
without any full path and commented with a semicolon.
There are two solution that worked fine for me.
1.- Including this line at php.ini file
extension_dir="X:/[PathToYourPHPDirectory]/ext
Where X: is your drive letter instalation (normally C: or D: )
2.- You can try to simply uncomment, deleting semicolon. Include the next line at php.ini file
extension_dir="ext"
Both ways worked fine for me but choose yours. Don't forget restart Apache before try again.
I hope this help you.
Hi I got this error because I left out the ampersand (&) in
; php.ini
error_reporting = E_ALL & ~E_DEPRECATED
Be sure you edited php.ini in /php folder, I lost all day to detect error and finally I found I edited php.ini in wrong location.
After change our php.ini, make sure to restart Apache web server.
Just for future reference, copying all these extension files to Windows/System or Windows/System32 is unnecessary.
All that is required is a copy of the php.ini file you edit in the PHP dir to copied to the root Windows dir.
phpinfo will clearly explain the below:
Configuration File (php.ini) Path C:\Windows
Logical sense will explain that php wants to load a config located in the Windows dir. :-)
One time I had a problem while using Off instead of off. And also check the pads one more time... The path has to be exact. Also add the following line to your environmental variable.
C:\your-apache-path\bin; C:\your-php-path\bin;C:\your-mysql-path\bin
If you are in Windows, right click My Computer, select properties, and navigate to the Advanced tab... (is Windows 7). Click on Advanced system settings first then select the Advanced tab and then Environmental variables. Select PATH and click on Edit. Make a copy of the string in a .txt file for back up (it might be empty)--- set your environmental variables... Log out and log back in.
Since mysql_connect This extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0. Instead, the MySQLi or PDO_MySQL extension should be used.
by default xampp does not load it automatically
in your php.ini file you should uncomment
;; extension=php_mysql.dll
to
extension=php_mysql.dll
Then restart your apache you should be fine
This same problem drove me nuts (Windows 10, Apache 2.4, MySql 5.7). For some reason (likely PATH related), the .dlls would not load after uncommenting the correct exension dlls and extension_dir = "ext" in php.ini. After trying numerous things, I simply changed "ext" to use the full directory path. For example. extension_dir = "c:/phpinstall/ext" and it worked.
I think that you should use mysqli_connect instead of mysql_connect

Resources