07975 997026 enquiries@ harpanet.com
First off, you need a working environment.
I set mine up in WAMP on Windows Vista. There's a great post from alstanto on the ZF Manual website (Zend Framework in WAMP) describing this type of setup, although my particular setup was slightly different in terms of wamp/zend folder locations: I have WAMP installed in
c:\wamp and Zend Framework 1.11.7 unzipped into
To prevent having to type in unweildly long command paths to get the ZF command line tool working, I added both the PHP location (
c:\wamp\bin\php\php5.3.5\) and the ZF bin folder (
c:\wamp\ZendFramework-1.11.7\bin) to my windows PATH as per alstanto's instructions. I didn't want to move folders out of the unzipped Zend Framework location, which I will have to do when moving the project to a hosted production environment.
With the path set up and PC rebooted, enter a Windows Command Prompt, and see if ZF is ready to be used. Type:
If you get a bunch of info about ZF then you have ZF and PHP ready to do your bidding.
Create a folder in wamp to hold your new project.
eg. for our project named SQUARE:
cd \wamp\www\square zf create project
This will create the following zend framework default folder structure within your project folder:
There is a good description of this and the various things that the zf tool creates over on the Zend Framework Quickstart pages.
You will also want to define a Virtual Host in WAMP at this point to test your website properly. There is a great description of doing this over on Wamp Virtual Host configuration - Infinite Designs, but basic details follow:
Edit your WAMP
httpd.conf file (in my case located at
C:\wamp\bin\apache\Apache2.2.17\conf\httpd.conf) and uncomment the Include line for 'extra vhosts' like:
# Virtual hosts Include conf/extra/httpd-vhosts.conf
Now edit your vhosts file (in my case located at
C:\wamp\bin\apache\Apache2.2.17\conf\extra\httpd-vhosts.conf) and create an entry something like:
<VirtualHost square="" local:80=""> DocumentRoot "C:/wamp/www/square/public" ServerName square.local # NOTE: The next line has been entered to set the ZEND FRAMEWORK environment SetEnv APPLICATION_ENV development <Directory "c:/wamp/www/square/public"> Options Indexes MultiViews FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>
You can see from the above DocumentRoot setting that the configuration expected for a Zend Framework website is to point the website root folder to the public folder in the ZF folder structure. Therefore, all other files other than public resources (css, images, etc.) reside outside the website making it more secure.
Finally, edit your windows hosts file to let your browser find your WAMP development website.
c:\windows\system32\drivers\etc (stupid location!) edit the file named
hosts (Note: you will need to be an Administrator user to be able to edit this file).
Put in a line like:
Restart your Web Browser, and you can now browse to your development site by typing:
http://square.local into the URL.
At this point you are 'almost' set up to begin developing with zend.