Installing a PHP Debugger

Here's a brief rundown on how to install your favourite Debugger for PHP. This assumes you already have php installed on your system and you're familiar with programming PHP.

There are two PHP Debuggers easily available. These are XDebug and The Zend Debugger. Which debugger is right for you? Don't ask me! Both run with Eclipse and xDebug runs with the Komodo IDE.

You can only run one PHP debugger!

It's handy to have a php info page displaying somewhere on your local machine so you can check where your extensions and php.ini file live.

Using PHP from the command line you can find your php.ini file like this:

php -r 'phpinfo();' | grep php.ini

You find your extensions directory like this:


php -r 'phpinfo();' | grep extension_dir

Installing XDebug

  • Download Xdebug here or here if you are looking for the Mac OS x version.
  • Place the extension in your extensions directory.
  • Next, you'll need to enable the xDebug extension in your php.ini file by telling php where the file is. This means adding the line below to your file and restarting The Apache Web Server.

    On windows it's probably:
    zend_extension_ts="c:\php\ext\php_xdebug-2.0.1-5.2.1.dll"
    On Mac OS X or Linux it's probably:
    zend_extension="/usr/lib/apache2/modules/xdebug.so"

    If your on windows, see below for Thread Safe option which you may need.

  • Check that you have the extension by running phpinfo(); or typing php -m at the command line.

Installing The Zend Debugger

  • Firstly, download the Zend Debugger here.
  • In your extensions directory stick your ZendDebugger.so or ZendDebugger.dll file. See above on how to find your extensions directory.
  • In your php.ini file place the line:
    zend_extension = ”full path to ZendDebugger.so or .dll"

    If your on windows, see below for Thread Safe option which you may need.

  • Next restart your Apache server and check your php.info file to see you extension loaded.

PHP on Windows

You may need Threadsafe extension on Windows. This is appended with '_ts' like so: 'zend_extension_ts'. To check if you need the Threadsafe version look for the text "Thread Safety" in your phpinfo().

PHP on Mac OS X

If you're on Mac OS X you may need to upgrade your version of PHP to work with some IDEs like Komodo. See:

http://www.entropy.ch/software/macosx/php/
http://www.entropy.ch/phpbb2
http://developer.apple.com/mac/articles/internet/phpeasyway.html
http://developer.apple.com/internet/opensource/php.html




Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options