Main menu

And then there was light...

Last week, I worked for the first time with a php debugger and finally things fell into place. I could see things I couldn’t see before, go into great detail, the obscure became clear...

My colleague Sven, showed me how to install xdebug on MAMP and Komodo IDE. We used this great article from Robert Douglass as a guide to get everything working.

This is just a rewrite for me to remember how to install it.

I have MAMP running on my machine and I use Komodo IDE.

How to install Xdebug to work with Komodo on MAMP

1. Download and install the Firefox add-on easy Xdebug.

2. Copy Komodo’s xdebug.so file to php’s directory. Since I work with Drupal I copy it to the php 5.2 directory.

cp /Applications/Komodo\ IDE.app/Contents/SharedSupport/php/debugging/5.2/xdebug.so /Applications/MAMP/bin/php/php5.2.17/bin

3. Add some lines to the php configuration file: php.ini

vim /Applications/MAMP/bin/php/php5.2.17/conf/php.ini

Added to the end of the file:

	[xdebug]
	zend_extension="/Applications/MAMP/bin/php/php5.2.17/bin/xdebug.so"
	xdebug.remote_autostart=off
	xdebug.remote_enable=1
	xdebug.remote_handler=dbgp
	xdebug.remote_mode=req
	xdebug.remote_host=localhost
	xdebug.remote_port=9000

You can start MAMP and go to phpinfo. You should find information about xdebug mentioned on the page.

4. In Komodo’s preferences. Set the Xdebug port to 9000.

Start up Komodo IDE. Go to preferences > Debugger > Connection and make sure the port is set to 9000.

That’s it. We can now start debugging our php code.

To start debugging do the following

1. Start easy Xdebug in Firefox

Navigate to the page you want to start the debugging session. Start the easy Xdebug plugin and hit refresh.

2. Set breakpoints and sep through the code in Komodo

That’s it. Have fun!