Configuring Xdebug

Xdebug PHP extension is required to allow PHP Tools to integrate debugging features into Visual Studio.

Choose the Right Xdebug Binaries

Choose the version depending on your PHP version, but always 32bit. It is strongly recommended to use non-thread safe (NTS) version on Windows.

You can also use following tool provided by Xdebug developers: Xdebug Wizard You can copy and paste in your phpinfo output. It gives you the correct version to download.

Copy Xdebug binary to your PHP Extensions Folder

PHP extensions folder is usually located within your PHP runtime, in ext subfolder.

Copy downloaded Xdebug binaries into the PHP extensions folder.

Update PHP Configuration

Edit PHP Configuration file. Its name is usually php.ini, and is located within your PHP runtime folder.

Add following lines at the end of your configuration file. Change the absolute path for xdebug so it corresponds to correct path on your system.

zend_extension = "C:\Program Files (x86)\php-5.4.8\ext\php_xdebug-2.2.1-5.4-vc9-nts.dll"
xdebug.remote_enable = on
xdebug.remote_handler = dbgp
xdebug.remote_host =
xdebug.remote_port = 9000
xdebug.remote_mode = req


  • From PHP 5.3 onwards, you need to use zend_extension and not zend_extension_ts.
  • Xdebug is incompatible with Zend Optimizer and Zend Studio Debugger extensions. These extensions should be commented out.
  • PHP Tools for Visual Studio has configuration check feature that can recommend and apply configuration changes depending your system.

xdebug.remote_port setting has to be the same as in PHP Tools options (in Visual Studio, Tools | Options | PHP Tools | Advanced). Default value is 9000 and it is usually sufficient to just leave it as it is.

Note: nginx server using FastCGI may block port 9000 by default. Change Xdebug port to 9001 both in php.ini and in Visual Studio settings. Note that restarting nginx will not reload php.ini! You will need to restart PHP, or your server.

Verify Installation

To verify your Xdebug installation, follow these steps:

  1. Create simple PHP file containing following:

    <?php phpinfo(); ?>
  2. Open the corresponding URL in your browser.
  3. You should see Xdebug section in the output.

If you don't see the section above in your phpinfo output, there may be something wrong with your PHP configuration or you need to restart your web server to let PHP update its configuration. If PHP Tools debugging session was started before configuration change, it is recommended to close it by exitting its systray icon or restarting Visual Studio.