Monday, August 26, 2013

How to get your first Zend framework work on WAMP?

This is not a new thing and you can find this anywhere, I just note it down for my personal reference just in case I'm too old to remember all this.

OS: Window 7 Enterprise
WAMP version 2.4

1. Download Zend project skeleton from https://github.com/zendframework/ZendSkeletonApplication

2. Unzip the Zend framework and rename it as "ZendProject".

3. Open DOS prompt and change to the "ZendProject folder"

4. Type in the command as shown below to download Zend framework
php composer.phar self-update

5. Type in the command as shown below to install Zend framework.
php composer.phar install
During executing this command line, you might encounter the error as shown below.
You must enable the openssl extension to download files via https
To resolve this error, please enable openssl at WAMP server. Open php.ini located at [WAMP_HOME_FOLDER]\bin\php\php5.4.12 uncomment extension=php_openssl.dll

6. Once the installation has been completed, the output as described below will be displayed
Loading composer repositories with package information
Installing dependencies (including require-dev)
  - Installing zendframework/zendframework (2.2.3)
    Downloading: 100%

zendframework/zendframework suggests installing ext-intl (ext/intl for i18n feat
ures (included in default builds of PHP))
zendframework/zendframework suggests installing doctrine/annotations (Doctrine A
nnotations >=1.0 for annotation features)
zendframework/zendframework suggests installing ircmaxell/random-lib (Fallback r
andom byte generator for Zend\Math\Rand if OpenSSL/Mcrypt extensions are unavail
able)
zendframework/zendframework suggests installing ocramius/proxy-manager (ProxyMan
ager to handle lazy initialization of services)
zendframework/zendframework suggests installing zendframework/zendpdf (ZendPdf f
or creating PDF representations of barcodes)
zendframework/zendframework suggests installing zendframework/zendservice-recapt
cha (ZendService\ReCaptcha for rendering ReCaptchas in Zend\Captcha and/or Zend\
Form)
Writing lock file
Generating autoload files

7. In WAMP server, I enabled vhost file by uncomment "Include conf/extra/httpd-vhosts.conf" in [WAMP_HOME_FOLDER]\bin\apache\Apache2.4.4\conf folder.

8. Add the configuration as displayed below in httpd-vhosts.conf file located at [WAMP_HOME_FOLDER]\bin\apache\Apache2.4.4\conf\extra folder.
<VirtualHost *:80>
    ServerName zend2
    DocumentRoot D:/work/research/Zend/ZendProject/public
    SetEnv APPLICATION_ENV "development"
    <Directory D:/work/research/Zend/ZendProject/public>
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

9. Edit "hosts" file located at C:\Windows\System32\drivers\etc folder.
127.0.0.1       zend2 localhost

10. Open the browser, type in URL "http://zend2/", the Zend2 framework page as displayed below will be displayed

2 comments:

Ruben said...

Now zend2 as well as localhost load the same content. How do I fix that?

Ruben said...

I just fixed id by adding the below virtual host to the httpd-vhosts.conf file


ServerName localhost
DocumentRoot "c:/wamp/www"
SetEnv APPLICATION_ENV "development"

DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all