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 http://framework.zend.com/releases/ZendFramework-1.7.0PR/ZendFramework-1.7.0PR.zip &&
unzip ZendFramework-1.7.0PR.zip &&
cd ZendFramework-1.7.0PR/library/ &&
mv Zend INCLUDE_PATH
Now we have ZF within our include path we need to setup PHPUnit & ZendStudio.
pear channel-discover pear.phpunit.de
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/ZendDebugger.so /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..