hooligan
hooligan

Reputation: 895

Zf Tool cannot find Zend Framework

Just started working with the Zend Framework Zf Tool and I've already come across a problem I've spent hours trying to figure out.

For some reason when I run the Zf show version command I get a ZF ERROR indicating it cant find the Zend Framework a to add it to my php.ini include_directory.

Here is my setup. I'm currently have WAMP installed on my local machine.

c:\wamp

I copied the zf.bat and zf.php files into the servers php directory. The path to the php directory has been added to the path environment variable. I'm pretty sure it works because I run the zf show version command in the console and get a ZF ERROR.

I keep my copy of the Zend Framework inside

c:\wamp\includes

So I added this to the php.ini include_path. include_path = ".;c:\wamp\includes"

I checked that this setting was set correctly by checking phpinfo() function. Which shows include_path .;c:\wamp\includes .;c:\wamp\includes

So I think I have everything setup correctly. I can't work out what I'm missing.

I also tried setting the ZEND_TOOL_INCLUDE_PATH with no success.

Any help would be appreciated. PS I did check other posts here but none of the suggested

Upvotes: 1

Views: 1932

Answers (4)

Chukky Nze
Chukky Nze

Reputation: 720

Just to add to what Tjorriemorrie said and to explain in detail how I got my installation on win 7 to work as simply as possible:

  1. Download your preferred Zend package from "http://framework.zend.com/downloads/latest" to "C:\wamp\www\"

  2. unzip your zip file so that you have the extracted Zend folder (with version name) under "C:\wamp\www\".

  3. Rename your folder by removing the version so that you end up with "C:\wamp\www\ZendFramework"

  4. Run a simple php file with phpinfo() in your browser. Note the entries for: "_SERVER["PATH"]" under PHP Variables "Path" under Environment "Loaded Configuration File" at the top "include_path" under Core and "extension_dir" under Core as well.

  5. "_SERVER["PATH"]" and "Path" must be identical (no brainer)

  6. There should be only one listing for your apache server and that should be the listing under "Loaded Configuration File" but without the "php.ini". So, if your "Loaded Configuration File" is "C:\wamp\bin\apache\apache2.2.22\bin\php.ini" you must have "C:\wamp\bin\apache\apache2.2.22\bin" in your path and that must be the ONLY reference to an apache server. If you have multiple references to apache servers Windows may pick the wrong one depending on your PATH order and use the wrong php.ini file.

  7. Your "extension_dir" will tell you the version and location of php you are using. It is common to have different php folders lying around such as "C:\php", "C:\wamp\bin\php\php5.4.3", "C:\wamp\bin\php\php5.3....", etc. The extension directory will tell you which one of these php folders ZF will "reference" when it is looking for its library. For example, if your extension directory says "c:/wamp/bin/php/php5.4.3/ext/", you want to focus on "c:/wamp/bin/php/php5.4.3"

  8. Go back to your PATH and a) add the string for this php version and b) remove all the other references to the other php folders

  9. Now that you know your running and primary php and apache folders, shutdown (do not restart), shut down your computer and boot back up (restart does not always let the PATH completely reset.

  10. Go to BOTH php.ini files at a) "C:\wamp\bin\apache\apache2.x.y\bin" and "C:\wamp\bin\php\php5.4.3" and find the include_path variable for Windows

  11. Replace the default line, which looks like: ;include_path = ".;c:\php\includes;" with include_path = ".;c:\php\includes;C:\wamp\www\ZendFramework\library" ON BOTH FILES just as Tjorriemorrie notes.

  12. Restart All Services by clicking the wamp icon and selecting said option

  13. At this point my zf tool was working. But, just to be safe, shut down and bootup

  14. Smile and grab a beer!

Upvotes: 0

hooligan
hooligan

Reputation: 895

I have worked it out! Finally. The way I have my local wamp setup there is 2 php.ini files I have to edit.

The one that made the different is the php.ini inside the Apache2 directory.

Thanks everyone for their help. I appreciate it.

Upvotes: 2

venimus
venimus

Reputation: 6067

If you extracted ZF from the archive you will get a Zend-some_version folder, but the actual ZF is in "include_path\Zend-some_version\library\Zend", so your include path should point include_path\Zend-some_version\library\

Upvotes: 0

prodigitalson
prodigitalson

Reputation: 60413

Well im not sure how you downloaded installed the framework but my guess is that you dont have enough of you include path based on the way Zend release packages are constructed. The Zend folder contained in the Zend Framework installation needs its parent folder to be on the include path so typically you would add something like:

c:\wamp\includes\ZF_BASE_DIR\library

This is because the zf package structure looks like:

ZendFramework-VERSION/
  README.txt
  INSTALL.txt
  LICENSE.txt
  bin/
  library/

Upvotes: 0

Related Questions