I'm having trouble debugging PHP. What do I do?

If you receive an error message when attempting to debug a PHP program or if the debugging process does not proceed as expected, verify that you have installed PHP and the Xdebug extension as per the instructions in the Debugging PHP documentation, then check the following:

Confirm PHP Configuration

xdebug

In the command or shell window, enter php -m. "xdebug" should be listed under Zend Modules (and not under PHP Modules). If this is not the case, your configuration is incorrect. See "Common PHP Configuration Problems" below.

Syntax Checking

In Komodo, select Edit|Preferences. Click on Smart Editing, and ensure that "Enable background syntax checking" is checked. Open a PHP file and enter something that is syntactically incorrect, such as:

<?
asdf
echo test;

Komodo should display a red squiggly line under echo test;. If it does not, it indicates that Komodo is not able to communicate with the PHP interpreter.

Debug

If the steps above were successful, ensure that the debugger is functioning by opening a PHP program and debugging it. Ensure that the correct Preferences are configured for PHP.

If any of the steps above were unsuccessful, proceed to the next section.

Common PHP Configuration Problems

Multiple PHP executables on one machine

In Komodo's Preferences, explicitly specify the PHP interpreter configured in your php.ini file. The location of the php.ini file can also be explicitly set.

Verify the PHP version

PHP 4.4 or higher is required.

Verify Xdebug library specification

The location of xdebug.dll (Windows) or xdebug.so (Linux) must be defined the php.ini file, for example:

  • Windows:
zend_extension=C:\php-5.3.2\extensions\php_xdebug.dll
zend_extension_ts=C:\php-5.2.17\extensions\php_xdebug.dll
  • Linux:
zend_extension=/php-5.3.2/extensions/php_xdebug.dll

Ensure that the Xdebug extension is configured correctly in the php.ini file as per the Remote PHP Debugging instructions.

Version Error Messages

If you receive a dialog with the following warning message:

Warning
xdebug: Unable to initialize module
Module compiled with debug=0, thread-safety=1 module API=20001222
PHP compiled with debug=0, thread-safety=1 module API=20001222
These options need to match

... download an updated version of xdebug.dll (Windows) or xdebug.so (Linux) from the Xdebug.org site.