Issues With Remote Debugging Using XDebug on IIS? (Updated)

UPDATE 11-13-2013: If you want to trigger the debugger on your IDE from another application other than a browser, you can use an application such as Fiddler and then add the following header to your request. If you already have a cookie, just append the below string with a semi-colon (;):

Cookie: <FIRST_COOKIE_VARIABLE>=<FIRST_COOKIE_VALUE>;XDEBUG_SESSION=<IDE_KEY>

If you have your web server on a different machine than your PHP IDE (I use PHPStorm) and you want to try to debug on the remote server, there’s a few things you’ll need to watch out for. If you’re having issues, try the following:

  • Make sure you download the appropriate DLL for IIS (e.g. threadsafe vs. non-threadsafe, 32-bit vs. 64-bit, DLL built for the specific PHP version that is installed on the server, etc.).
  • Make sure your php.ini on the server has the appropriate configuration parameters. Here’s my configuration section for XDebug:
    [XDEBUG]
    xdebug.remote_enable=1
    xdebug.remote_connect_back=1   ; Make sure this is set if you're remote debugging!
    xdebug.remote_host="localhost" ; This is ignored when xdebug.remote_connect_back is set to true
    xdebug.remote_port=9000
    xdebug.remote_handler="dbgp"
    zend_extension = "C:\Program Files (x86)\PHP\v5.4\ext\php_xdebug-2.2.3-5.4-vc9-nts.dll" ; Make sure this points to the correct DLL
  • Make sure your IDE is configured correctly with the correct IDE Key. To find the IDE Key that’s set on the server, create a page with phpinfo() on it and search for the XDebug configuration section. If you’re using PHPStorm, here’s a good guide.
  • Download the appropriate browser plugin to activate the debugger, then set the options for the extension to use the IDE Key that’s set up for the server.

Leave a comment if you need more help and good luck!