Posts Tagged ‘Zend’


Getting ZendDebugger to work on Centos5.1

October 21, 2008

Well I had to setup a Zend Studio for Eclipse on Centos today, me thinking that it would be a blissful journey, abruptly followed by the realization that Centos wasn’t going to play nice. First thing after a clean install I ran yum update to make sure the system was up to date.

I tried to install ZendFramework 1.7, ZendStudio6.1 & PHPUnit3 and installed as I have before but came against a brick wall, PHPUnit would not install, due to PHP-XML being missing.
yum install php-xml
Which installs php-xml5.1.6, okay, I know I need 5.2 at least but for now I want to make sure PHPUnit will install.
pear channel-discover
pear install phpunit/PHPUnit

Once PHPUnit was installed I ran the test cases, ZS complains with the follow:
Error launching 'AllTests.php
The session counld not be startd.
In order to generate debug inormation, please make sure that the debugger is properly configured as a php.ini directive

I run phpunit from shell to get:
Failed loading /usr/lib/php/modules/ /usr/lib/php/modules/ undefined symbol: zend_memory_usage

Okay so ZendDebugger isn’t working, php -v shows me:
PHP 5.1.6 (cli) (built: Sep 20 2007 10:16:10)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

So I need a new version of PHP, PHP5.2.6 will do, yum update php tells me that 5.1.6 is that latest version, so I need to find a repository that has one.

cd /etc/yum.repos.d

Edit the line below.


your file should now look like this:
name=CentOS-5 Testing
# CentOS-Testing:
# !!!! CAUTION !!!!
# This repository is a proving grounds for packages on their way to CentOSPlus and CentOS Extras.
# They may or may not replace core CentOS packages, and are not guaranteed to function properly.
# These packages build and install, but are waiting for feedback from testers as to
# functionality and stability. Packages in this repository will come and go during the
# development period, so it should not be left enabled or used on production systems without due
# consideration.

Now run the following

yum install php

You should get something simular to this….
Package Arch Version Repository Size
php i386 5.2.6-2.el5s2 c5-testing 1.2 M
php-cli i386 5.2.6-2.el5s2 c5-testing 2.4 M
php-common i386 5.2.6-2.el5s2 c5-testing 230 k
Updating for dependencies:
php-ldap i386 5.2.6-2.el5s2 c5-testing 31 k
php-xml i386 5.2.6-2.el5s2 c5-testing 97 k
Transaction Summary

Now I ran the test and got the following error.
Failed loading /usr/lib/php/modules/ /usr/lib/php/modules/ cannot restore segment prot after reloc: Permission denied

Okay, that was totally unexpected, so after a little searching with my best friend (google) I found the following command
/usr/sbin/setenforce 0
Ran the tests again….
phpunit AllTests.php
PHPUnit 3.3.2 by Sebastian Bergmann.

Time: 0 seconds

OK (7 tests, 0 assertions)

Perfect & running within ZS gives me the below results, job done.

One thing to make note of; when I restarted the box, SELinux had been reactivated so I disabled SELinux by doing the following (this is not ideal, i’ll have to look allowing doing this a better way).

vim  /etc/sysconfig/selinux
and changing
Doing this disabled SELinux so that we I wouldn’t get the permissions error. Alternatively I could of placed the setenforce command in a startup script (bashrc or something simular).


Installing ZendStudio 6.1

October 20, 2008

Okay, I’ve done this so many times & helped a few people do the same that I thought It would be a good idea to actually document the process. I’ll explain the basic steps to getting ZendStudio working with PHP5.2.6 & PHPUnit3, this setup will allow you to use the same library files as the actual system instead of the environment prepacked with ZS6.1 (I prefer this way as running tests in ZS6.1 should produce the same results when run via CLI.

ZF latest version
ZendStudio for Eclipse 6.1

Make sure that php is atleast at version 5.2 (php -v will tell you the version), update if needed. Download Zend Framework and place in your php include path (typically /usr/share/php or /usr/share/pear).

If pear is not installed we’ll need install it using the following for Debian based systems (remember you’ll need to be root to install via apt or yum).
apt-get install php-pear
yum install php-pear
for RHEL based systems.

cd /opt &&
wget &&
unzip &&
cd ZendFramework-1.7.0PR/library/ &&

Now we have ZF within our include path we need to setup PHPUnit & ZendStudio.
pear channel-discover
pear install phpunit/PHPUnit

We need to download ZendStudio from here & running the file
./ZendStudioForEclipse-6_1_0.bin Follow the instructions & wait for the installation to complete.

Now we’ll need to customise ZS so that it will work with using the systems PHP & PHPUnit instead of the ones packed with ZS.

We’ll need to setup ZendDebugger to work with our systems php.ini file, so we will need to copy ZendDebugger from ZS and place in with the other modules.
cp /PATH/TO/ZEND/plugins/org.zend.php.debug.debugger.linux.x86_5.2.14.v20080602/resources/php5/ /usr/lib/php5/

Here we need to add the below text into our php.ini file, ideally at the bottom, so it is easy to find.

Once installed and started, select Window, Preferences & you’ll be given a window simular to below.

Click Add, which will bring up the dialog box below.

Enter the following, the path to the systems php executable & your php.ini file as entered in the above screenshot and click Finish.

The dialog box will close and leave you with Figure 1.1, select the newly added settings and click Default. We have now setup ZS to work with our systems PHP version instead of the one packed with ZS.

We now need to add a our PHP include path to ZS so that we have all our library files available for ZS.

Click New, which will display the below dialog box, this is where we need to set our current PHP path, the screenshot below displays an example.

Once the include path has been added we click OK and OK again, now when ever we create a new project, we will just remove the predefined paths and just include our one.

Well that’s it, now we should be able to run tests within ZendStudio & the shell, knowing that our results come from the same environment..