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 –

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 and follow the instruction in the installer.

3.  Get the skeleton of zend framework from GitHub

The skeleton is available at

Open the GIT powershell

C:\GitHub> git clone 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%

The “” 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

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”
<Directory C:\wamp\www\zf2\public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all

In your windows host file located at c:\windows\system32\drivers\etc\hosts

This is it. On browser type and you are all set to explore ZF2.

I find it easy !

June 6, 2013

Horde_Text_diff Package

My research for the “Text_Diff” started with small requirement where in we are expected to track the changes made by authors in single content. This requirement is  very common in publishing industry, where multiple authors are editing the contents and moderator wants to track the changes.

“Text_Diff” is the common PHP pear package which is now  “Horde_Text_Diff”

I had a tough time making it work but finally I did and got some initial results

To install please follow the steps given at following

I am considering you are able to install the package with a help of pear and pear is running all well at your machine.

require_once ‘Horde/Text/Diff.php’;
require_once ‘Horde/String.php’;
require_once ‘Horde/Text/Diff/Renderer.php’;
require_once ‘Horde/Text/Diff/Renderer/Inline.php’;
require_once ‘Horde/Text/Diff/Engine/Native.php’;
require_once ‘Horde/Text/Diff/Op/Base.php’;
require_once ‘Horde/Text/Diff/Op/Change.php’;
require_once ‘Horde/Text/Diff/Op/Copy.php’;

$from_text=file(./CH001.html’);   //Original File
$to_text=file(./CH001_edited_author.html’);  //Modified file
/* Create the Diff object. */
$diff = new Horde_Text_Diff(‘auto’, array($from_text,$to_text));

/* Output the diff in unified format. */
$renderer = new Horde_Text_Diff_Renderer_Inline();
echo $renderer->render($diff);

The above code snippet will show you the changes . But, the challenge remain to see the changes in different colors to quickly identify that these are the edits.  When you will be working with Horde Package you will get lot of “Class not found” error which will make you add those files in your include section. Horde also comes with autoloader class which I would be exploring shortly :).

Create a free website or blog at

%d bloggers like this: