How to set up Zend_Tool on Windows.

A few people we’re having issues installing Zend_Tool on Windows, hell I was having trouble myself since all of the tutorials out there are either Macs or Red Hat based.  So dont feel bad if your reading this :-).  I thought i would take some time and create a tutorial, from the ground up and learn a few things myself along the way.  So here we go!

Step one Installing PHP (if you havent yet)
If you have PHP already installed skip this section and head over to “An overview of the installation”.  Eeryone else, head over to the PHP site,  php.net and download the latest and greatest. As of this writing the latest Windows installer is php-5.2.9-2 msi.  Download the executable.  Yea so what I use executable and you should too its easier to install and configure on Windows.
Once the file downloads, double click the installer, click “next” a few times, and stop when you reach the “Choose Items to Install”.

choose_itemsChoose Items to Install
Once you reach this point your going to check off which extensions you want installed.  By default the installer has a few modules turned off but you can easily turn them on by checking off the items to install.  Make sure that the “CLI Executable” has no red x marks next to it as shown in the neat picture to the left.   If it does click on the “X” and select,  “Will be installed on local hard drive”.  By doing this your going to installed the php.exe file as well as allow the executable to automatically update and create System Variables. Click “Next”, then “Install” and watch it go.

system_var

An overview of the Installation and Required System Variables
When the installation is done you should have a new directory, C:\Program Files\PHP (if you didnt change the default location).  This contains the php.exe file along with a number of other things.   You should also have some updates to your environment variables.  Open the Environment Variables window by right clicking on “My Computer” , “Properties”,  “Advanced”, “Environment Variables” .  At the bottom of the window you should have 2 System Variables, “Path” and “PHPRC”.  Make sure “Path” contains the “C:\Program Files\PHP\;”  (Replace with the location of your PHP directory) and make sure PHPRC contains, “C:\Program Files\PHP\” (Location to your php.ini file) .    If all the variables are set click “Ok” and head onto the next section.

Verifying Installation.
Now to check that the installation went smoothly.  Open a command line window.  You do this by going to “Start”, “Run”, and then typing in “cmd”, then click “Ok”.  Once the command line window appears type in:  php –version

You should see:

php_version

If you do great!  Your done with PHP. Let’s install Zend Framework now.

Installing Zend_Tool
If all went well,  now its time to install Zend_Tool. Download the latest Zend Framework (latest is 1.8.1)  and extract the files somewhere onto your system.   Move the files

  • bin/zf.php
  • bin/zf.bat

into the directory C:\Program Files\PHP and place all the content of the library folder into the C:\zf directory.  Many tutorials recommend installing the library in your PHP includes directory but I decided to install it under C:\zf to demonstrate how to use ZEND_TOOL_INCLUDE_PATH environment variable since the library can practically live anywhere when your developing sites.    The full path to your Zend Framework instillation is now, C:\zf\library\Zend.

Setting up ZEND_TOOL_INCLUDE_PATH
Open the Environment Variable window again and create a new environment variables under the “System Variables”  section.   In the “Variable Name”  text field enter, “ZEND_TOOL_INCLUDE_PATH”  and in the “Variable Value” text field enter “C:\Program Files\PHP\includes\library\”  (path to the Zend Library minus the Zend portion).   Click ok to close out the “New System Variable” window and then click “ok” once again to close the “Environment Variable” wndow.  Time to check if Zend_Tool works.

Verify Installation
If you have any command line windows open, close them and then reopen one.   Type in zf show version you should see the below:

zf_command

Useful commands.
Your set to create your projects , controller, actions now. Below I added a few commands I tend to use.

Create Project
zf create project helloworld

Create a new controller (below commands must be issued within project directory)
zf create controller controller1
zf create controller controller2

Create a few actions
zf create action action1 controller1
zf create action action2 controller2

Thats it!
Armando Padilla

9 thoughts on “How to set up Zend_Tool on Windows.

  1. Pingback: CLI php.exe not found - Zend Framework Forum

  2. This is fantastic! Before this, the only way i could get ZT to work was by installing zend server CE. This was very simple and well explained method! Now, if only ZT could create an entry in my HOSTS & vhosts.conf files.

    Great stuff!

    Thanks

  3. Just a question.

    How I’m doing that with ‘xampp’?
    I’m running that on vista.

    Thanks

  4. Hi Aad,

    I would assume is the same set up. I will do a clean isntall of xampp and Vista on a virtual box and see what pop up.

    Armando Padilla

  5. Worked great for me on XP. The only suggestion I would make is to include the path to the PHP folder (in your case: C:\Program Files\PHP) in the Windows PATH variable. Otherwise the ZF command won’t run in your project folder.

  6. There is an error on “zf create controller books”…
    it is telling me An error has occurred… A project profile was not found . what do i do

  7. Hi Armando

    Since i am using windows xp 64bit and localhost never loads up, i tried using easyphp, zendserver CE and wampserver, i don’t know if you could guide me on this.

    So I installed wampserver on a separate machine (older windows xp 32bit) in my wireless network. I have mapped C:\wamp\ as Z:\ on my xp64. Not sure how will i set up my Env vars in this instance. On my xp64 i set Env vars which is referring to Z:\bin\php\php5.2.9-2 but it doesn’t work as expected as the associated files refer to C:\wamp\…

    If you could help me how can i get working with Env vars if the server is on a seperate windows machine?

    BTW, congrats on being one of very few early writers of ZF books. Bought yours from Apress, a gr8 reading.

    cheers
    Pradosh

  8. Not able to create controller..when i type “zf create action add index” inside the project root dir… iam getting “‘”php.exe”‘ is not recognized as an internal or external command,”

Comments are closed.