Tag Archives: easyphp

Zend Framework 2 – Create New Project From Scratch

I’ve noticed many users are still incapable of getting Zend Framework 2 going on there local machine. I’m going to run a very thorough explanation of how I got it working.

Information and tools used throughout this tutorial:
Zend Framework 2 online tutorial
Windows 7 (64 bit)
EasyPHP DevServer 13.1 (everything that comes with it)

Let’s begin.

Step 1: Download and install EasyPHP DevServer 13.1

(If you installed PHP and MySQL some other way then just follow the instructions and make sure all your settings are identical to get Zend Framework 2 working)

Step 2: Make sure your PHP variable is working correctly. To do so, open Terminal by clicking Start, type “cmd“, click on “cmd.exe“. Once the terminal is open, type “php -v” and press Enter. If setup correctly, you will see PHP version and some other information, if not you will get an error along the lines of “php is not a recognizable command …“.

If PHP variable is working correctly then skip directly to Step 3, otherwise read on.

(EasyPHP should setup this correctly on install, if you used something else to install PHP then perform the following procedures:
– Find and the copy your full path to php.exe, (ex. C:\Program Files (x86)\EasyPHP-DevServer-13.1VC9\binaries\php\php_runningversion)
– Open Environment variables settings (Right-click “Computer” icon, click Properties, then click “Advanced System Settings” on the left side panel, then click “Environment Variables” button at the very bottom.)
– In the bottom list, find PATH in the first column and click Edit button.
– Place the pointer to the beginning of the line and paste the previously copied full path to PHP.exe.
– Add a semi-colon “;” after the path)

Step 3: Download Zend Framework 2 skeleton application from here.

Step 4: Inside your working directory (where you keep all your PHP projects, ex. “www”) create a folder “zf2-tutorial” and unzip the contents of Zend Framework 2 downloaded file in there.

In my case (because I’m using EasyPHP), the local working directory is “C:\Program Files (x86)\EasyPHP-DevServer-13.1VC9\data\localweb\projects“, so I placed my “zf2-tutorial” folder inside the “projects” folder.

End path where “zf2-tutorial” is placed is: C:\Program Files (x86)\EasyPHP-DevServer-13.1VC9\data\localweb\projects\zf2-tutorial

Step 5: Now onto the fun stuff with Zend Framework 2. Open the Terminal again, type the following command to switch inside “zf2-tutorial” folder:

In your case, you place the path to your “zf2-tutorial” folder.

Step 6: Type the following command and press Enter:

Let the process complete.

Step 7: Type the following command and press Enter:

Let this process complete before you proceed. It may take a while. (I got an error here because EasyPHP comes with OpenSSL is disabled and I couldn’t proceed. If you did too, just open php.ini file and un-comment openssl extension.

Step 8: Now let’s add virtual hosts to httpd.conf file. Open httpd.conf file and find (commented out) example of Virtual Hosts setup. Now paste the following below the example but don’t comment it out like the examples:

The only 2 things you have to change is the path to your zf2-tutorial project. First is on the DocumentRoot line and second is inside the first Directory tag. If you are using EasyPHP then just replicate the path to the example I provided.

Step 9: Modify your hosts file. (You won’t be able to save your hosts’ file changes unless you open it in Notepad (or other editor) as Administrator).



I kind of wish I had a step 10 but I don’t. Your Zend Framework 2 setup should be working flawlessly right now. Let me know if you have any questions and I’ll do my best to try and assist you in your setup.