2

I cannot debug a PHP script as a script. It always terminates immediately after starting. I set up an Xdebug log in my php.ini, but it's completely unhelpful. Xdebug does show up on my phpinfo(), so I know it's loaded in Apache.

I can also debug code as a webpage (which provides no info on variables and will not stop on breakpoints though), so I know Eclipse has the proper server settings. Both debug options use the same PHP exe (the one installed with XAMPP, php 5.3.1 compiled with vc6 compiler). I made sure that the compilation of Xdebug matched these settings.

On a perhaps related note: I noticed that I could only load Xdebug with the zend_extension command, instead of zend_extension_ts even though my version of PHP is indeed thread safe? I have to admit I'm a little confused by that.

I also made very sure that wherever I could select "XDebug" in Eclipse, I did. I've followed two tutorials to no avail here. Anyone have any ideas? I've tried the version of Xdebug bundled with my XAMPP (2.0.6-dev) and I also downloaded a new .dll, version 2.1.

Thanks!

F_C
  • 1,011
  • 3
  • 11
  • 16

2 Answers2

6

Excellent instructions for Setup XDebug on XAMPP and Eclipse @user629300 Instructions are good for eclipse versions prior to 3.5 see the links to get instructions for version based instructions. Also Getting XDebug to work with apache xampp to debug php, has pictures with good explanations. They are a little stale though.


A summary of the details from the first link, assuming PHP > 5.3 (which hopefully everyone is running now!):

  • Make sure that your php.ini file contains the following:

    [XDebug]
    zend_extension={xampp-folder}\php\ext\php_xdebug.dll
    xdebug.remote_enable=1
    xdebug.remote_host="localhost"
    xdebug.remote_port=9000
    xdebug.remote_handler="dbgp"
    
  • Remove any config entries under the [Zend] heading, particularly those starting with zend_extension
  • Configure Eclipse:
    • in Window -> Preferences -> PHP -> Servers, configure the PHP server to use XDebug, add the base URL and local web root
    • in -> Installed debuggers, configure XDebug to accept remote sessions
    • (optional?) configure the PHP executable to point to php.exe in your XAMPP installation

You should now be able to hit breakpoints in Eclipse by adding XDEBUG_SESSION_START to the query string of your URL, e.g. http://localhost/?XDEBUG_SESSION_START.

Tom Fenech
  • 72,334
  • 12
  • 107
  • 141
  • 1
    Pro tip for fools like me who blindly dumped the config lines from the example in the first link and couldn't get it working: the quotes used are _smart_ i.e. `“` and `”` - they should be changed to regular double quotes `"`. – Tom Fenech Jun 03 '15 at 19:58
  • Don't forget to stop, then restart, Apache, to cause the new PHP.INI to be read – Mawg says reinstate Monica Oct 29 '16 at 13:08
  • You can use this Chrome plugin to define de XDEBUG_SESSION_START when you want to debug. This with help you with the POST call. https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc?hl=fr – Michael Feb 07 '18 at 14:03
-1

first download the dll for xDebug then edit your php.ini file zend_extension_ts = “C:\xampp\php\zendOptimizer\lib\ZendExtensionManager.dll” make sure the line is uncommented restart apache make sure you are editing the right php.ini file

user629300
  • 39
  • 1
  • 4