Priti's Technical Corner

June 14, 2013

Install Zendframework 2.2.0 on WAMP


I came across many developers who are starting with ZF2 that installation is difficult hence I thought of exploring it. Before zend framework 2 setup I have to install “Composer” and Git on my machine.

1. To install composer download it’s window installer for composer’s site – http://getcomposer.org/download/

While installation I faced following error

“The openssl extension is missing, which will reduce the security and stability of Composer. If possible you should enable it or recompile php with –with-openssl”

I enabled openssl extension on my WAMP server.

Still faced the same error and I ignored and installed
Go to window command prompt and verify the installation of composer

C:\>composer -V
Composer version 06dff68ce78cd6a2cef1da61ec749c47c73we5769

2. To install git for window download the installer for windows from  https://help.github.com/articles/set-up-git and follow the instruction in the installer.

3.  Get the skeleton of zend framework from GitHub

The skeleton is available at  https://github.com/zendframework/ZendSkeletonApplication

Open the GIT powershell

C:\GitHub> git clone https://github.com/zendframework/ZendSkeletonApplication C:\wamp\www\zf2
Cloning into ‘C:\wamp\www\zf2’…
remote: Counting objects: 2174, done.
remote: Compressing objects: 100% (851/851), done.
remote: Total 2174 (delta 1069), reused 2056 (delta 991)
Receiving objects: 100% (2174/2174), 774.99 KiB | 43 KiB/s, done.
Resolving deltas: 100% (1069/1069), done.

Once, the skeleton is downloaded we need to load the dependency hence we will use composer as shown below

Open window command prompt and go to the dir where you installed ZF skeleton. In my case it’s C:\wamp\www\zf2

C:\wamp\www\zf2>php composer.phar self-update
Updating to version 06dff68ce78cd6a2cef1da61ec749c47c73d5769.
Downloading: 100%

C:\wamp\www\zf2>php composer.phar install
Loading composer repositories with package information
Installing dependencies (including require-dev)
– Installing zendframework/zendframework (2.2.0)
Downloading: 100%
Downloading: 100%
Downloading: 100%

[Composer\Downloader\TransportException]
The “http://nodeload.github.com/zendframework/zf2/zip/release-2.2.0” file c
ould not be downloaded: failed to open stream: Unable to find the socket tr
ansport “ssl” – did you forget to enable it when you configured PHP?

install [–prefer-source] [–prefer-dist] [–dry-run] [–dev] [–no-dev] [–no-c
ustom-installers] [–no-scripts] [–no-progress] [-v|vv|vvv|–verbose] [-o|–opt
imize-autoloader]

If composer is not installed properly then you will get the above error message. I fixed it by enabling it in php.ini for CLI.

Please note, WAMP uses different php.ini files for CLI and Apache. To resolve above error please modify C:\wamp\bin\php\php-5.4.3\php.ini to enable openssl mod.

restart all the services. In some cases you may need to uninstall and re-install the composer after fixing above issue.

C:\wamp\www\zf2>php composer.phar install
Loading composer repositories with package information
Installing dependencies (including require-dev)
– Installing zendframework/zendframework (2.2.0)
Downloading: 100%

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

make following changes in your “httpd.conf” setting

<VirtualHost *:80>
DocumentRoot “C:\wamp\www\zf2\public”
ServerName  zf2-dev.com
<Directory C:\wamp\www\zf2\public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

In your windows host file located at c:\windows\system32\drivers\etc\hosts
127.0.0.1       zf2-dev.com

This is it. On browser type http://zf2-dev.com and you are all set to explore ZF2.

I find it easy !

Advertisements

5 Comments »

  1. you are the best.
    thank you

    Comment by pierre — July 19, 2013 @ 8:52 am

  2. Great article!..
    Its working Fine… Thank you

    Comment by Sijo — August 1, 2013 @ 1:40 pm

  3. Best article i have seen so far.
    Thanks for the information

    Comment by Hudson — October 22, 2013 @ 9:41 am

  4. what changes have to be made about virtualhost in httpd.conf?
    Thanks

    Comment by Hudson — October 22, 2013 @ 10:47 am

  5. very nice…

    Comment by keshav — February 7, 2014 @ 6:53 am


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: