You can use Komodo to debug PHP programs locally or remotely, including debugging in CGI or other Web Server API environments. See instructions below on how to configure Komodo to debug PHP using the PHP Configuration Wizard. programs. To manually configure PHP for debugging, see the Komodo FAQ. For general information about using the Komodo debugger, see Komodo Debugger Functions. Komodo handles local and remote debugging of PHP programs differently than it handles Perl and Python programs. Komodo provides a debugger extension called ActiveDebug.dll. You must install this extension file for Komodo to debug PHP scripts. Local PHP DebuggingIn Local Debugging mode, Komodo executes PHP directly. While this is convenient for quickly debugging a PHP script, if your script depends on the availability of a web server environment, you will need to use Remote Debugging. Under local debugging, certain environment variables are not available, such as those provided by the CGI environment. You do not need to have a web server installed to use Komodo's local debugging features. Otherwise, local and remote debugging work the same, and are configured nearly the same. Once you have configured PHP to use the debugger extension, you can debug your scripts simply by opening a PHP file, and going to the Debug menu, then clicking on "Step Into". Remote PHP DebuggingRemote debugging requires PHP to call Komodo. After you have followed instructions to configure PHP for remote debugging, you can start remote debugging. Go to the Debug menu, and click on "Listen for Remote Debugger...". When PHP is executed, it will contact Komodo and initiate a remote debugging session. This can be configured to happen with a web server, so that you can initiate a PHP program using a web browser, then debug the script with Komodo. Viewing VariablesThe Variables tab in the Output Pane displays the global and the local variables. Global variables include all variables available in the global scope. Local variables include all the variables available in the scope your program is in. That is, if you call a function, you go into a new scope, so the local variables will change. You can interact with these variables - you can change the variable value by double-clicking the variable in the Locals tab and entering a new value. Configuring the PHP DebuggerBefore you can debug PHP scripts in Komodo, PHP must be configured to use the ActiveDebugger extension (ActiveDebug.dll). Komodo requires PHP version 4.0.5 or greater. You can download PHP from http://www.php.net/downloads.php. If you want to debug PHP scripts under a web server environment, be sure PHP is operating correctly with your web server before configuring the debugger extension. Consult the PHP documentation for notes on configuring PHP with your web server. Note: If you are installing PHP for the first time, the PHP installation program may not work correctly on Windows Millennium; please refer to the PHP site for installation instructions. Using the PHP Configuration WizardThe PHP Configuration Wizard simplifies the process of selecting a PHP executable to use for debugging, copying the PHP.ini file to a new directory and modifying it for debugging, and copying the ActiveDebugger extension to the directory defined in the .ini file.To start the wizard:
The wizard will guide you through the four main steps necessary to configure the debugging extension. 1. Choose InstallationThe first step assumes that you have PHP installed. If you do not have PHP, you can download it from www.php.net. If you have more than one version of PHP installed, you can choose which version you want to configure. Browse to the directory containing the php.exe file or enter the directory path in the Set up this installation field. Click the Next button. 2. Choose PHP INI PathNext, choose the php.ini file to be copied and its destination directory. Note that if you modify the original file at at later time, the changes will not be available in the version you copied to the debugger. You can either modify the the file in the debugger, or rerun this wizard to copy the changes. Click Next. 3. Choose PHP Extension DirectoryMany PHP installations already include a default "extensions" directory. This is where the debugger extension should be installed. If you have specified an extensions directory in the .ini file, you do not need to change the path that appears in the Use this extensions directory field. It is important that the extensions are installed in the same directory as your PHP installation. If you choose a different location, some extensions may not work. Once the desired path has been set, click Next. 4. Ready to InstallThe final window in the wizard displays the installation options you have selected. Confirm that the selections are correct and click Next. If you want to change any of the selections, click Back. Note: If you want to manually configure PHP for debugging, see the instructions in the Komodo FAQ. For an introduction on using Komodo to debug PHP, see Using the PHP Remote Debugger. Single Person Remote PHP Debugging In single person remote debugging, you can configure PHP to always look for a specific Komodo instance on a specific machine. This configuration requires no changes to the PHP script. Your web server and your instance of Komodo can be on one machine or two machines. See below for further information. Multiple Person Remote PHP Debugging In multiple person remote debugging, you can configure PHP to accept different Komodo instances on different machines. Use this method when you have several people and several machines all able to debug PHP scripts on a single web server. Note that only one person will be able to debug any given script at a time.This configuration requires changes to the PHP script on a per-user basis. Near the top of your PHP script, add the following command:
You can add this line anywhere in your PHP script, but Komodo begins the debug process only when this line in your script is reached. The Komodo debugger begins on the line following asdbg_break(). If you add the asdbg_break() command without parameters, Komodo uses the default PHP parameters defined in the php.ini file. Configuring PHP Debugging on an Apache ServerApache configuration directives provide additional flexibility in configuring PHP for debugging. If you have configured your Apache installation to use Virtual Hosting (see httpd.apache.org/docs/vhosts/), you can add additional directives to your VirtualHost sections to differentiate how Komodo's PHP debugger extension operates for those hosts. Use the "php_admin_value" to set specific debugger settings for that virtual host. Here is an example: NameVirtualHost * <VirtualHost *> php_admin_value activedebug.enabled 0 DocumentRoot "/Apache/htdocs/" ErrorLog logs/www.error.log Servername www.yourdomain.com </VirtualHost> <VirtualHost *> php_admin_value activedebug.enabled 1 DocumentRoot "/Apache/htdocs/" ErrorLog logs/debug.error.log Servername debug.yourdomain.com </VirtualHost> This will enable debugging under debug.yourdomain.com, but not under www.yourdomain.com. You can additionally configure the virtual host to use a specific machine for remote debugging: <VirtualHost *> php_admin_value activedebug.enabled 3 php_admin_value activedebug.host komodo.yourdomain.com DocumentRoot "/Apache/htdocs/" ErrorLog logs/debug.error.log Servername debug.yourdomain.com </VirtualHost> For more information on configuring Virtual Hosting under Apache, see the Apache documentation at httpd.apache.org/docs/. ![]() Using the PHP Remote DebuggerTo Komodo, remote PHP debugging is similar to running PHP under a web server (such as Apache or IIS) as a CGI or server plug-in. You have CGI variables available and all other variables you would expect to have available when running PHP under a web server. Note that debugging is slower in a remote debugging configuration. For an introduction to how Komodo handles PHP debugging, see PHP Debugger Overview. To debug a PHP script:
To stop the debugger:
![]() Configuring PHP for CGI DebuggingKomodo's Remote Debugging functions are specifically designed for CGI environments. Follow the instructions in Configuring the PHP Debugger for configuring Komodo to debug CGI applications written in PHP. ![]() PHP Debugger TroubleshootingIf you have attempted to debug a PHP script and receive an error message, there are a few things you can verify prior to contacting ActiveState's technical support. Confirm PHP Configuration
If any of the steps above were unsuccessful, proceed to the next section. Common PHP Configuration Problems
Windows-Specific Configuration Issues
Linux-Specific Configuration Issues
Version Error MessagesIf you receive a dialog with the following text: Warning
you need to download an updated version of the ![]()
|