Setting up eclipse with xampp and xdebug to debug php code.

This post will show you how to setup eclipse on your mac to work with xdebug inside XAMPP. This setup will allow you to step through your code as it runs, line by line, add breakpoints in your eclipse code, view variable values as your code is running and all the other cool things that xdebug lets you do.

eclipse with xampp and xdebug

Eclipse with XAMPP and xDebug

  • install eclipse
  • install xampp with xdebug
  • open a project [or create a new one]
  • goto elipse > preferences > php > servers
  • Click ‘add new’
  • type in a name + put in the url you use to view (eg http://localhost/mysite)
  • click the ‘browse’ button and navigate to where your source code is (eg /home/users/username/development/mysite)
  • click ‘next’
  • make sure to pick xDebug as the debugger.
  • click ‘next’
  • in the ‘path mapping’ section, click ‘add’
  • fill in your details
  • eg: path on server = /
  • eg: path in workspace = /mysite
  • hit finish

You can now use eclipse with xampp and xdebug to debug your php code.
if you have set your document root of your XAMPP to be the same place you save your projects to then you can set breakpoints, etc and have the code open at the correct place without having to do mappings =)



Javin @ FIX Protocol Tutorials · February 26, 2011 at 5:53 am

Nice article , just to add I would suggest start up script to put JVM debug parameter and use a variable e.g. isDebugEnabled and also REMOTE_DEBUG_PORT in the script and export this variable when you want to remote debug your Java application. This will be very handy and will require just one time setup work.

How to setup remote debugging in Eclipse

aamani · April 3, 2011 at 10:48 am

Which url we need to use in step 6.
Is it “/applications/xampp/”

mmncs · August 18, 2011 at 1:53 pm

Hi there,

Nice guide! Here is a complete guide on how to setup a PHP development environment in Linux Ubuntu 10.04 or 11.04 with the new Eclipse Indigo 3.7 IDE, LAMP and Debugging. Check it out here:

clod · May 13, 2019 at 9:46 am

I prefer to use Codelobster IDE with xDebug