Bookmark and Share

Remote debugging PHP using Xdebug on MAMP

Posted: Thursday, May 21st, 2009 at 10:19 pmUpdated: Thursday, May 28th, 2009 at 5:38 pm

Configure Eclipse for remote debugging

So we have our test script running. We now need to configure Eclipse to start listening for remote debug. Within Eclipse IDE, click on Run -> Debug Configurations. You should have a window similar to the one below.
eclipse-debug-configuration

Click on PHP XDebug Remote Script to select it, then click on New launch configuration icon. Name it something meaningful. On the main tab, make sure that Remote Debugging Tutorial project is selected. As for identification string, you can type anything. I like to keep it short, so I just choose 1.
eclipse-remote-debug-config-1

On the Pathmap tab, click on new button. Since both the debug client and the MAMP server are on the same machine, the local path and the remote path are the same. In our tutorial case, it’s /Applications/MAMP/htdocs. Type the same path for remote path. Then click on Ok button.
eclipse-remote-debug-config-2eclipse-remote-debug-config-3

The other 2 tabs are normally okay to leave as default. Then next, click on Debug button. Then go to debug perspective. You should see that Eclipse IDE is now ready for remote debugging.
eclipse-remote-debug-perspective

Next, we’ll start remote debugging and we’ll step through the code and watch the variables as the program runs.

Pages: 1 2 3 4

2 Responses to “Remote debugging PHP using Xdebug on MAMP”

  1. Javin @ FIX Protocol Tutorial Says:

    Nice article , In my opinion Remote Debugging is the single most feature which convinced me to migrate from Netbeans to Eclipse.

    Thanks
    Javin
    How to setup remote debugging in Eclipse

  2. Zholeh Says:

    Hi, I had the same problem with the vabiarles view being opened causing the debugger to fail with the cryptic message. I fixed it in a very strange way:1) I changed the xdebug module from the default that came with xampp (1.7.4) with php_xdebug-2.1.0-5.3-vc6.dll.2) I also made sure that the path for xdebug in php.ini was relative instead of absolute: zend_extension = \xampp\php\ext\php_xdebug-2.1.0-5.3-vc6.dll;These two things took me from frustrated axe murderer to prancing unicorn. I’m to scared to mess about with it to determine if it was just the module change or the php.ini change. Hope this helps someone.

Leave a Reply

Time limit is exhausted. Please reload the CAPTCHA.