Aptana Studio Help > Getting Started > Developing with the Aptana PHP Plugin

Remote PHP Debugging

THESE INSTRUCTIONS ARE EXPERIMENTAL

Please post any problems you have using these instructions to the PHP forum

Contents

Basic Setup

Setting up PHP on Apache

#load the php main library
Loadfile "C:\php\php5ts.dll"

#load the sapi so that apache can use php
LoadModule php5_module "C:\php\php5apache2_2.dll"

#set the php.ini location
PHPIniDir "C:\php"

#Hook the php file extensions
AddHandler application/x-httpd-php .php
AddHandler application/x-httpd-php-source .phps

Setting up XDebug in php.ini

[XDebug]
;Hook the XDebug
zend_extension_ts=C:\php\ext\php_xdebug-2.0.3-5.2.5.dll
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"

Verify the installation

  1. Restart Apache
  2. Create a PHP file named phpinfo.php in Apache's htdocs directory containing something simple, such as <?php phpinfo(); ?> to the file and save it.
  3. Open this file in your web browser using Apache: "http://localhost/phpinfo.php" and you should see the standard phpinfo output.
  4. Verify that the XDebug was loaded by locating the note at the bottom of the first section. It should say something like: "with Xdebug v2.0.3, Copyright (c) 2002-2007, by Derick Rethans"

Aliasing to your PHP project

Assuming that you already have a PHP project set up in your Aptana Studio, you need to create an Apache Alias pointing to that project. It is crucial that you will name your alias exactly like you named your project

For example, a project named RemoteDebugTest should have this Alias setting in the httpd.conf:

Alias /RemoteDebugTest C:\Eclipse\workspace\RemoteDebugTest
<Directory C:\Eclipse\workspace\RemoteDebugTest>
Order allow,deny
Allow from all
</Directory>

After saving httpd.conf, restart Apache to make your changes effective.

Creating a launch configuration

  1. Place one or more breakpoints in the file to be debugged, which must exist in the project you aliased for Apache
  2. Open the launch configuration dialog by accessing the debug shortcut (or by using the action from the menu Run -> Open Debug Dialog)
  3. Create a new PHP Web Page debug configuration
  4. Verify that the XDebug debugger is selected and that you use the properly configured Apache server
  5. Select Use specified script and locate the file you wish to debug
  6. Make sure that the Studio XDebug client is listening on port 9000. The port is set on the Preferences panel Aptana -> Editors -> PHP -> Debug, and the XDebug listen port should be the same one you set in php.ini.
  7. Start debug

At this point a debug session is initiated. A browser is opened and, in case your code hits the breakpoint, you'll see that the debug stack is paused on the line in the source code.

Notes