Remote Debugging PHP in Eclipse with XDebug

Remote Debugging PHP in Eclipse with XDebug prereqs:
1) This post assumes you already have a working xdebug install
2) Eclipse

Configuring Eclipse and Xdebug

  • Open Eclipse
  • Inside Eclipse, goto preferences > php > debug > debuggers
  • Change the debugger to xdebug
  • Click configure
  • Change the dropdown for “accept remote session (JIT)” to “any” or “prompt”
  • Click ok

Setting Up Remote Debugging Paths

  • 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
  • The exact path mappings will depend on your project

PHP Step Debugging

To set a breakpoint, click in the gutter to the left of the line number

Remote PHP Debugging Using Eclipse: Initiating a debug session:

Install the eaxy-xdebug instension in your browser:

Using Firefox – Xdebug Helper is the best solution I have found for firefox – simply install the extension from here, navigate to the site you want to debug, and click the little green bug, select debug and reload your page to open in your editors debugger.

Using Chrome – Xdebug Helper is the best solution I have found for chrome – simply install the extension from here, navigate to the site you want to debug, and click the little green bug, select debug and reload your page to open in your editors debugger.

Once you reload your page in your browser, eclipse will prompt you to open a debug session. You are now Remote Debugging PHP in Eclipse with XDebug!

Remote Debugging PHP in Eclipse with XDebug