Step 1 - Copy the Debugging Extension to the Web Server
Before debugging PHP scripts in Komodo, PHP must be configured to use the Xdebug extension (php_xdebug.dll or xdebug.so).
Find the appropriate extension for the version of PHP you are running and manually copy it into a directory on the server that the PHP interpreter and web server can access. The Xdebug files can be found in the php sub-directory of the Komodo installation. For example:
- File:
xdebug.so - Location:
<komodo-install-directory>/Contents/SharedSupport/lib/support/php/debugging/<PHP-version>/
zend_extension_tsorzend_extension- Should be set to the full path to the xdebug library on your system. Use
zend_extension_ts("thread safe") on Windows andzend_extensionon other platforms. xdebug.remote_enable- Enables remote debugging.
xdebug.remote_handler- Should be set to
dbgpfor use with Komodo. xdebug.remote_mode- Set to
reqto have the script connect to Komodo when it starts. Set tojitto connect only on an error condition (see PHP Just-in-Time Debugging / Break on Exception). xdebug.remote_host- Set to the hostname or IP address of the computer running Komodo or the DBGP Proxy. Use 'localhost' or '127.0.0.1' if Komodo and the web server are running on the same system.
xdebug.remote_port- Set to the same value as the debugging listener port configured in the Debugger Connection preferences (or the system assigned Host Port displayed under Debug|Listener Status)
xdebug.idekey(optional)- If you are using the DBGP Proxy, set this to the Proxy Key configured in the Debugger Connection preferences.
Once the php.ini file is updated, verify that Xdebug is configured by running the following command:
Starting and Stopping a PHP Remote Debugging Session
Once remote PHP debugging is configured, the PHP interpreter can contact Komodo and initiate a remote debugging session when a PHP script is executed on the web server.
To initiate remote debugging from a web browser:
- Ensure PHP is installed and configured properly for your web server.
- Ensure Komodo and PHP are configured for remote debugging (as described in "Configuring Remote PHP Debugging").
- Click Debug | Listen for Debugger Connections.
- In your browser, enter the URL of the script you want to debug. Append
?XDEBUG_SESSION_START=1to the end of the URL (an HTTP GET with a true boolean value). For example:http://example.org/sample.php?XDEBUG_SESSION_START=1
If you are using the DBGP Proxy, the value for the GET method should match the Proxy Key value shown in Debug|Listener Status. For example:http://example.org/sample.php?XDEBUG_SESSION_START=jdoe
It is also possible to callXDEBUG_SESSION_STARTby adding it in aninputelement of an HTML form. For example:<input type="hidden" name="XDEBUG_SESSION_START" value="jdoe" />
Note: This is only required for the first request. After that, Xdebug tracks the debugging session with a cookie. For more information on how this works, see www.xdebug.org/docs-debugger.php#browser_session - A PHP debugging session starts in Komodo. On the Debug menu, click Step In or Go/Continue to run to the first breakpoint.
No comments:
Post a Comment