Xdebug configuration with PHP fastcgi and eclipse?

mac picture mac · Dec 8, 2009 · Viewed 14.3k times · Source

I have been using eclipse-pdt in conjunction with xdebug and apache without problems, for over one year. Things worked flawlessly and I could do all the interactive debugging I wanted from within eclipse (using my own machine as a server).

Now I switched from apache to nginx (and therefore PHP runs now not as an Apache service but as fast-cgi) and I can't find a way to configure eclipse to work nicely with xdebug. I am neither sure if the problem is with xdebug or with eclipse (or both) to be sure.

In the eclipse configuration I already changed the reference to the PHP configuration file to /etc/php5/cli/php.ini.


Attempts with php.ini version 1

With the following php.ini file

zend_extension=/usr/lib/php5/20060613/xdebug.so
  • I see that xdebug is working (for example if I do a var_dump() I get the xdebug version of it, not the plain PHP one)
  • I can't have the interactive debugging from eclipse: the browser opens up and loads the page completely with the typical URL containing ...?XDEBUG_SESSION_START=ECLIPSE_DBGP&KEY=..., but the program execution does not stop at breakpoints
  • In the bottom-right corner of eclipse I see a suspicious message: "Launching =put_the_name_of_my_project_here=: 57%" that alternates with the "refreshing workspace" one.

Attempts with php.ini version 2

If I use this other version of the file (which is what it worked until I switched to nginx):

zend_extension=/usr/lib/php5/20060613/xdebug.so
xdebug.remote_enable=On
xdebug.remote_autostart=On
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_mode=req

I can't access any page of my sites at all.


PS: Additional data on my machine: - OS: GNU/Linux - Ubuntu 9.10 64 bit. - PHP: 5.2.10-2ubuntu6.3 with Suhosin-Patch 0.9.7; Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies with Xdebug v2.0.4 - Eclipse: see screenshot.

alt text

Answer

Maxence picture Maxence · Jul 25, 2011

xdebug and FastCGI use the same default port (9000). Change the port of XDebug in your php.ini file like this:

xdebug.remote_port=9001

and update your IDE settings to use 9001.