Bugger off, bugs!

Good thing among others of being a zend certified engineer is that you get an unlimited Zend Studio license with the certification :) .

Installed Zend Studio 8 and there’s a Zend Toolbar plugin available for Firefox 5.x. This will be used for starting a debug session directly from the browser.

Zend Studio Toolbar

Zend Studio Toolbar

The plugin needs to know the path to the zend studio executable, for me that’s
/Applications/Zend Studio.app. Default for Zend Studio broadcasting port is 20080, leave it at that.

I’m looking at the following construction:
Zend Studio and Firefox running on Mac but the actual application is running on a guest Ubuntu VM in VirtualBox that’s accessing the code lying in a shared folder on the Mac disc.

Now how to get the debugger up and running? First thing is to decide which debugger to use. As I’ve got no idea yet if xDebug will work with that browser plugin, let’s go for Zend debuger first.

Download ZendDebugger-20110410-linux-glibc23-i386.tar.gz for Ubuntu. Note to use the Version compatible to you actual php version. Put the file named dummy.php that comes with the package into document_root of the web application you’d like to debug.

File ZendDebugger.so goes into the PHP extension directory /usr/lib/php5/20090626+lfs on the guest VM.

Add following entry to php.ini.

[zend]
zend_extension=/usr/lib/php5/20090626+lfs/ZendDebugger.so
zend_debugger.allow_hosts=192.168.2.110,127.0.0.1/32
zend_debugger.expose_remotely=always

Oh, and best use the same php.ini file for cli and apache PHP. I linked the apache php.ini (/etc/php5/apache2/php.ini) to the cli php.ini ( sudo ln -s /etc/php5/cli/php.ini php.ini ).

Restart apache. You can check if the extension is loaded by calling get_loaded_extensions PHP internal function.

Now we need a few settings in Zend Studio. Make sure to use the appropriate PHP executable. This can be set in section preferences.

Setting PHP executable

Setting PHP executable

Set the debug configuration in Zend Studio

debug configuration

debug configuration

Here we go, Zend Studio can connect to debugger. What’s done there is a call to dummy.php like
http://localhost:8090/dummy.php?debugger_connect=1 that is answered by “No connector is installed.” in case the debugger extension is NOT correctly loaded.

Zend Debugger

Zend Debugger

Happy debugging!

This entry was posted in tools and tagged , , , . Bookmark the permalink.

Leave a Reply