How to debug php in Aptana Studio – Part 2

In the previous tutorial, we have discussed how we can debug php scripts using Aptana Studio. In this tutorial, we will continue part 1 and learn how we can use Aptana Studio to debug a php webapp deployed on a remote server. Debugging an app is very helpful when we are not sure where is the exact issue and using echo to debug our scripts force us to modify our code. To avoid using echo for debugging purpose, we can use Aptana Studio and XDebug Extension. Another advantage of using debugging is to learn the code which we do not know but use in our projects like any Open Source library.

The pre-requisites to follow this tutorial are:

1. We have gone through the previous tutorial.
2. Apache, Aptana Studio and PHP are installed.
3. Debugging is enabled for php.ini file.
4. In the previous tutorial, we have used the ini file located within the php installation directory. To follow this tutorial, we need to include the ini file present within apache directory. On an windows system having wamp installed, The settings could be:

PHP Interpreter configuration














We also need to configure the PHP Debug options for Aptana as shown below:

PHP Debug

PHP Debug

The below mentioned steps can be followed to debug a remote app:

Step 1: Configure php.ini file located within apache bin directory. It must have the installation directory set for XDebug extension and the debugger is enabled for remote debug.

zend_extension = "F:/wamp/bin/php/php5.4.16/zend_ext/php_xdebug-2.2.3-5.4-vc9.dll"

xdebug.remote_enable = On

Now restart Apache after making these changes to php.ini file.

Step 2: Create PHP Project – To create a php project using Aptana Studio, click on File -> New -> PHP Project and than enter a project name of our choice. The important thing is to create the project under www directory of Apache. Though we can use symlinks or alias for our project, but to keep it simple, we will use Apache www directory.

Create PHP Project









Step 3: Create the project layout for a web project as shown below. In this project, we have created two php files. The php file index.php welcome us and have a link to call debug.php file.


Step 4: Add some code for debugging purpose in the php file debug.php. We will use the same for loop we have used in the previous tutorial.


Step 5: Now we need to create a PHP server in Aptana Studio which connects remotely to Apache Server. It can be done by clicking on Debug -> Debug Configurations and click on PHP Web Page.



To create a new configuration, we need to click on New Launch Configuration as shown above. We can give any name to this configuration. To add a new server, we need to click on the plus icon next to PHP Server select box. We can give any name to this server and the base url based on server location. The same technique can be used to debug a server located on other machine which allows access to the default xdebug port 9000.

Add PHP Server

After creating the server for debugging, we need to specify the initial script which will be launched when we run the php web app. The final configuration should look like as shown below:


At last we need to click on Apply Button and than Debug Button. It will launch the initial script page i.e. index.php on the browser.


To trigger the breakpoint on debug.php file, we need to access it by clicking on the Click Here Link on browser. It will take some time for the first time to launch the debugger. Once it starts, it will ask to switch to the Debug Perspective on Aptana Studio as shown below:

Switch Debug Perspective

Now click on Ok Button and it will open the debug perspective.


Rest of the steps are same as we discussed in previous tutorial. Once we are done with debugging, the rest of the script will be executed and the output will be displayed on browser in case it’s a regular GET request.

You may also like...

1 Response

  1. August 26, 2014

    […] next part remote debug php explains how we can remote debug php scripts installed on Apache Web […]

Leave a Reply

Your email address will not be published. Required fields are marked *

Show Buttons
Hide Buttons