loading

How To Set Up Zend Framework With Wamp For Local Testing And Web Development

If you’re trying to install Zend Framework with Wamp for local development, then hopefully this will help.  I’m assuming you’ve already got Wamp up and running, then tried the Zend Framework Quickstart and it had a head-fit on you…

We’ll keep it simple. Either extract/install as I do below letter for letter, or amend the filepaths accordingly to match your own.  This is just how I did it on my local machine – no settings or instructions are intended for live sites, and any changes you make to your system are at your own risk.

First off, I have installed:

Wamp Server 2.0
Apache Version : 2.2.11 as shipped with Wamp Server
PHP Version : 5.3.0 as shipped with Wamp Server

  1. If you need to, download Wamp Server and install.

Set Up Zend Framework

  1. Download Zend Framework – Register with them first if you haven’t yet done so.
    Go to http://framework.zend.com/download/latest, click on ‘Zend Framework Full Package’ free download.
  2. Download the .zip for Zend Framework 1.10 full (recommended) 1.10.8 as at the time of writing
  3. Assuming your wamp directory is the same as mine “C:\wamp\www”  unzip the Zend Framework so you have this file structure “C:\wamp\www\zend” – within this folder you should have folders  bin, demos etc :-
    Wamp and Zend Framework folder structure

    Wamp and Zend Framework folder structure

  4. Now don’t get too excited – that’s the Zend Framework set up within your C:\wamp\www\zend directory. Next, start Wamp Server.

Set Up Wamp / Apache

  1. Click on the Wamp icon in your Taskbar
  2. Go to Apache > Apache Modules > make sure “rewrite_module” has a tick next to it.
  3. Restart Wamp (Click Wamp icon in Taskbar > Restart All Services is simplest.  Or you can go click on Wamp icon in Taskbar > Apache > Service > Restart Service
  4. Now we edit php.ini.  Click on Wamp icon > PHP > php.ini
  5. Click Ctrl F, or go to Edit > Find in Notepad – find “include_path”.  We need to amend the line:include_path = “.;c:\php\includes”If this line has a semicolon before include_path, remove it.Now add in:”;C:\wamp\www\zend\library”(without the quotes) to the very end, but just before the closing quotes.  Mine looks like this (with the quotes):include_path = “.;c:\php\includes;C:\wamp\www\zend\library”Note the semicolon between the two filepaths.  This separates the two paths- don’t forget it.
  6. Now we need to edit Windows Environment Path variable.
    Go to Start > Search > search for “System Environment Variable”.  Click on Edit System Environment Variables.
    You should get this window.  If not, open your Control Panel > System > Advanced System Settings.  (I’m on Win7 x64, maybe different for Vista / 32 bit users)

    Advanced System Settings.

    Advanced System Settings.

  7. Click on Environment Variables, then find “Path” in the System variables, click Edit:
  8. Environment Variables

    Environment Variables

  9. The Edit System Variable window pops up – and we want to add the highlighted text below to the very end of the Variable Value:;C:\wamp\www\zend\bin

    *Don’t forget the semicolon at the end of the existing text to separate the path you are adding.  Click OK.  This will allow us to run the Command Line later on.

    Edit System Variable window

    Edit System Variable window

  10. Re-boot.

Create a test domain for development.

Instead of using localhost, this is how to set up a test domain called dev.local for your development environment.  Then you just hit dev.local into your browser for testing as opposed to localhost

  1. Open httpd.conf – Click Wamp icon in taskbar > Apache > httpd.conf
  2. Find this line, and uncomment it by removing the ‘#’ from the beginning of the line.  This tells apache to then include the httpd-vhosts.conf file.  Save and close.
    Now open httpd-vhosts.conf – if your directory structure is as we’ve been following above, then it should be in C:\wamp\bin\apache\Apache2.2.11\conf\extra.  (Apache2.2.11 is version specific if you have a different version choose that folder).

    Open it with notepad.

  1. Then add this domain as highlighted to the file as per the text and image below.

#first Domain

NameVirtualHost dev.local

<VirtualHost 127.0.0.1:80>
ServerName  dev.local
ServerAlias dev.local
DocumentRoot C:\wamp\www\zendtest\quickstart\public
ErrorLog “C:\wamp\www\zendtest\quickstart\public\error.log”
CustomLog C:/wamp/www/zendtest/quickstart/access.log common
<Directory “C:\wamp\www\zendtest\quickstart\public”>
Options -Indexes FollowSymLinks Multiviews
AllowOverride All
<IfModule mod_access.c>
Order allow,deny
Allow from all
</IfModule>
</Directory>
</VirtualHost>

If you don’t have the text setting VirtualHost 127.0.0.1 for C:/wamp/www, (the ‘not highlighted’ text) then add that too.

Save and close.  Restart Wamp services.

One other thing – check your Zend framework and library folders aren’t read-only.

Create Zend Project

  1. Create a new, empty folder for your new Zend project in C:\wamp\www – call it zendtest
  2. Open your Command Prompt – type:cd C:\wamp\www\zendtest*You should now see:C:\wamp\www\zendtest> in your command prompt window.
  3. Now we want to run the zf.bat file we added to the Environment Variables above. Enter:C:\wamp\www\zend\bin\zf.bat create project quickstart*Your full line of text in the Command Prompt should look like:C:\wamp\www\zendtest>C:\wamp\www\zend\bin\zf.bat create project quickstart.This tells Windows to run zf.bat, and create a new project in a new folder called quickstart, within zendtest folder.Open windows Explorer and check that your C:\wamp\www\zendtest\quickstart folder has been created.
    Within that folder should be the folders/files below.

    Now, when you go to http://dev.local in your browser, hopefully you’ll see this!  You should be good to go to carry on with the rest of the Zend Framework quickstart guide.

    Thanks to Tawfekov for instructions on setting up dev.local – see his video here (HD) or here at zendcasts (plenty of user comments) for further info on Wamp and Zend Framework.

    If you want to set up Zend Framework with Xampp, go here.

One Response to “How To Set Up Zend Framework With Wamp For Local Testing And Web Development”

  1. If anyone else has problems installing the zend framework with wamp on xp, I had to not only add C:\wamp\www\zend\bin to the Path environment variable, I also had to add the path C:\wamp\bin\php\php5.3.5 which is the path to my php directory.

Leave a Reply