Install ZEND Framework 2 on Your WAMP and XAMPP Server

I am a php web application developer; I am working on WAMP Server. I found some difficulties to setup Zend Framework 2.x in my localhost. You may found some difficulties in installing the zend framework 2.x like me, that’s why I have written this article, hope you will found find this article helpful.

  1. Download ZF2 skeleton app from GitHub https://github.com/zendframework/ZendSkeletonApplication as a  .zip  format

Zend 2 from git hub2. Extract your ZendSkeletonApplication-master.zip file to your  www directory and Rename the folder as your project name. In my localhost, it’s zf2crud.

3. Go to C:\wamp\bin\php\php5.3.5 or if you use xampp just go to C:\xampp\php and copies the folder path.

4. Right-click on My Computer inside your start-menu and click Properties,

5. Click Advanced tab inside System Properties.

System properties Setting for zend framework   6. Click “Environment Variables” Button and Select “Path” inside your “System variables” Sections. A new window will pop up once again

7. In the lower of the two boxes search for the variable Path and double-click it

Add path for zend framework 2 installation8.  Leave everything as is and just EXTEND the variable by ” ;C:\wamp\bin\php\php5.3.5” or “;C:\xampp\php” (of course adjust your xampp/wamp directory)

Add new system path for install zend framework 2 and run php on CLI

9. Enable your php_openssl Module From your php.ini File

10. Hit ok, ok, ok, start a new CLI (!) and once again check what php -v returns. It should work now.

check php to CLI11. Go to your CLI , change the directory to the project directory. Write command “cd C:\wamp\www\zf2crud” or if you use xampp “cd C:\xampp\htdocs\zf2crud” and press enter

change CLI path to install zend framework12. Now run “php composer.phar self-update” in your CLI

php composer.phar self update 13. After Completing php composer.phar self update now run “php composer.phar install

This will take a while to download and generate autoload files.

zend framework 2 installation

In that mean time, setup the virtual host. assuming that virtual host is zf2crud.localhost

14. Assuming that I’m going to setup a host named zf2crud.localhost and my host files are in C:\wamp\www\zf2crud\public

  1. Click WAMP icon on quick launch then Apache -> httpd.conf to open apache config file.

Change virtual host for zend frameworkd

2. Go to bottom of the file and add following host settings.

<VirtualHost *:80>
ServerName zf2crud.localhost
DocumentRoot C:\wamp\www\zf2crud\public
SetEnv APPLICATION_ENV "development"
<Directory C:\wamp\www\zf2crud\public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
  • And also add this if you already do not have this, this will give access to the localhost as usual
<VirtualHost *:80>

ServerName localhost

DocumentRoot C:\wamp\www

SetEnv APPLICATION_ENV "development"

<Directory C:\wamp\www>

DirectoryIndex index.php

AllowOverride All

Order allow,deny

Allow from all

</Directory>

</VirtualHost>

For xampp settings Go to your xampp control panel click Config and open Apache (httpd.conf)

change virtula host in xampp server13. Open the windows host file. in my case, C:\WINDOWS\system32\drivers\etc and place

127.0.0.1 zf2crud.localhost

Finally go http://zf2crud.localhost/ to run your zend framework 2 demo

Zend Framewor 2 Installation

goodgood verygood 🙂

Install ZEND Framework 2 on Your WAMP and XAMPP Server

Hi, My name is Masud Alam, love to work with Open Source Technologies, living in Dhaka, Bangladesh. I graduated in 2009 with a bachelor’s degree in Engineering from State University Of Bangladesh, I’m also a Certified Engineer on ZEND PHP 5.3, I served my first five years a number of leadership positions at Winux Soft Ltd, SSL Wireless Ltd, CIDA and MAX Group where I worked on ERP software and web development., but now i’m a co-founder and Chief Executive Officer and Managing Director of TechBeeo Software Consultancy Services Ltd. I’m also a Course Instructor of ZCPE PHP 7 Certification and professional web development course at w3programmers Training Institute – a leading Training Institute in the country.
68 comments on “Install ZEND Framework 2 on Your WAMP and XAMPP Server
  1. An excellent tutorial! I had to copy hosts file to another folder, make changes and then paste back. Also had to disable Avira’s protection of this file temporarily.

  2. Wow man! very nice you saved my life yeah! i live in Brazil and i were searching in many places this help and i weren’t finding anything! you really helped me! thank you very much! Viva o php! =D

  3. i have followed the same path..
    in the end i got XAMPP welcome page instead of zend framework 2..
    Kindly can you help me to identify my mistake is this procedure.

    Thanks

    • try like this in c:/windows/system32/drivers/etc
      # 127.0.0.1 activate.adobe.com
      127.0.0.1 zf2crud.localhost
      may be its useful to you

  4. Fatal error: Uncaught exception ‘RuntimeException’ with message ‘Unable to load ZF2. Run `php composer.phar install` or define a ZF2_PATH environment variable.’ in F:\xampp\htdocs\zendcrud\init_autoloader.php:48 Stack trace: #0 F:\xampp\htdocs\zendcrud\public\index.php(9): require() #1 {main} thrown in F:\xampp\htdocs\zendcrud\init_autoloader.php on line 48

    This is the error throwing while performing the said instructions in windows 7 xampp

  5. This process is very hard :O
    i use xampp 1.8.1 on Windows7.
    is there any way that i can work with it easily?

  6. After updating the hhtpd-conf file. I couldn’t access localhost

    on accessing the localhost the zend default site opened. What will i do to enable localhost wamp page

  7. Fatal error: Uncaught exception ‘RuntimeException’ with message ‘Unable to load ZF2. Run `php composer.phar install` or define a ZF2_PATH environment variable.’ in C:\xampp\htdocs\zf2crud\init_autoloader.php:48 Stack trace: #0 C:\xampp\htdocs\zf2crud\public\index.php(14): require() #1 {main} thrown in C:\xampp\htdocs\zf2crud\init_autoloader.php on line 48

  8. Hello I did the same thing as you did in your tutorial but the following error:
    address not found
    Firefox can not find the server at http://www.zf2-tutorial.localhost.
    Please check the syntax of the address
    (entry ww.exemple.com instead of
    http://www.exemple.com for example);
    If you are unable to load any pages, check the connection
    to network your computer;
    If your computer or network is protected by a firewall or proxy,
    make sure that Firefox is permitted to access the Web.

  9. I successfully installed Zend framework on my localhost. Thanks for that. I need one more help. How to install ZFTool on zend 2. Please help this beginner if anyone know it.

  10. Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator at [email protected] to inform them of the time this error occurred, and the actions you performed just before this error.

    More information about this error may be available in the server error log.

    error occur after the change in the httpd.conf file

  11. Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator at [email protected] to inform them of the time this error occurred, and the actions you performed just before this error. More information about this error may be available in the server error log. error occur after the change in the httpd.conf file

  12. Hi Masud vai how are you? I your your fan and one of the reader of this site. Now, I would like to learn Zend Framework.could you please help me?

  13. I have installed the zend framework but it says

    Access forbidden!
    You don’t have permission to access the requested object. It is either read-protected or not readable by the server.

    Error 403

    localhost
    11/19/13 10:45:38
    Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1

    Please Help

    Thanks in Advance!!

    • First of all thanks for the tutorial, it’s great.

      I have met the same access problem via using xampp.
      I’ve solved the access problem by replacing the “C:\wamp\www\zf2crud\public” data in the etc/host file with “C:\xampp\htdocs\zf2crud\public”.

      I hope it helps 😉

    • Hi Din,

      I was getting same issue. You can solve this by making changes in php.ini file…

      I know you second question.. That you already did this but remember when we access php from command line it use another php.ini file which completely different from wamp.
      You can find php.ini file at
      C:\wamp\bin\php\php5.3.13
      edit this file and allow https module…

      Enjoy!!!!!!

  14. Hello Developer
    Greetings!

    This is fantastic tutorials its real useful to developer.
    Big thanks to you.
    Thumbs up for this tutorials

    • To enable openssl- 1. go to your xampp control panel
      2.Click config of Apache 3. Find an cllick php( php.ini) from the list 4. Find out (Ctrl+f) ;extension=php_openssl.dll 5. Just remove the ” ; ” from the beginning. 6. Save , exit and restart your xampp. Hope you can now install ZF2.
      For Vhost code – copy the code from here and just paste it at the bottom of that file. Keep in mind to save that file you have open that file as administrator. Thanks.

  15. Hello!
    I can access my vpshop.local correctly. But when I access only localhost it also takes me to Zend public/index.php page.
    How can I access my xampp folder structure typing “localhost” on my browser?

    Thanks!

  16. Hello Guys,
    Please tell me which method is best by using skelton or by using we also create a projects for the skelton installation process or simple download the zend framework , install and create project.
    Thanks in advance.
    Thanks and Regards,
    HItesh

  17. Thanks for the post but when I tried installing zf2 as described above and when i try to access the page it says page not found. Can someone tell me why?

  18. Easy steps to install Zend-Framework-2, Thanks a lot, Please mention one more line here -> Restart the apache server after all the steps.

    Again Thanks to Masud for detailed steps.

  19. Thanks for this post. But I am getting this command “php_openssl” in php.ini, Please help me. I am using PHP Version 5.3.1 . Please reply am as soon as possible.
    Thanks

  20. i am getting error when i am installing composer :

    failed to open stream : No connection could be made because the target machine actively refused it

  21. Hi,
    I am new to zend framework please reply query as soon as possible

    I am getting this error when am installing composer the error is failed to open stream : No connection could be made because the target machine actively refused it.

    Thanks

  22. i was fail to install zend framework from many days and finally i get success from this tutorial. thanks man .
    keep sharing good work .
    regards,
    Muhammad Azam

  23. Hi sir I have problem on Step 12.
    I have run php composer.phar self-update but given below error.
    could not open input file composer.phar
    Even I have configure my php.ini file on following path
    C:\wamp\bin\php\php5.4.16

    Please help me.

    Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *