Configuring NetBeans 8 with XDebug Connection on WAMP

Posted: 2014-12-11 01:34:19

Configuring and connecting NetBeans with XDebug to run and debug local PHP projects and scripts is very simple.

These instructions will work for any WAMP, such as Xampp or WampServer, but are specific to WampDeveloper Pro (as it already provides everything needed).

Load and Configure PHP’s XDebug Extension

Open PHP’s configuration file: php.ini.

Find and un-comment the XDebug section that already exists near the end of php.ini, by removing the “;” from each settings line. Save file. Restart Apache.

; Note that profiler is enabled separately.

The provided XDebug settings will work with the NetBeans IDE out-of-the-box. The configuration uses as many default values as it can, and nothing needs to be changed as long as NetBeans is on the same system WAMP is on.

Create NetBeans Project

We will set up a project that uses the website, and it’s contents (the index.php file).

New project:

PHP Application with Existing Sources

Sources Folder:


* Changed from the pre-filled default to update to the website’s DocumentRoot folder.

Project Name:


PHP Version:

PHP 5.6

Runs As:

Local Web Site (running on local web server)

Project URL:

* Changed from the pre-filled default of “localhost” to website’s Primary Domain Name. And removed the “/webroot” part, as it’s not a URL, it’s the website’s DocumentRoot folder.

Index File:


Finish Project.

Start Debugging

In NetBeans, open the index.php file, and set a debug break-point on any PHP line.

* Use “<?php” instead of “<?” for your PHP code unless you’ve enabled the NetBeans option to use short-tags in the project.

Make sure Apache is running, and click the IDE’s “Debug Project” (not “Run Project”) icon.

It will open the system’s default Browser to URL:

That “XDEBUG_SESSION_START” part tells PHP to start XDEBUG for that request, and it will provide NetBeans the debug data by sending it to the specified IP and Port (in php.ini) / which is the address NetBean’s XDebug client is listening on.

You should be able to now step through the PHP code using the NetBeans IDE!


If for some reason your PHP code can’t handle the query string, you can enable “xdebug.remote_autostart=1” (php.ini) to auto start debugging for all requests. But this will slow everything down further, and also generate much more data.

Once done, make sure to stop the Debugging process so everything get’s cleared out.

If there are any issues with Apache and PHP request timeouts, these can always be increased.

And if any odd issues start happening with either the Browser or the XDebug sessions:

Also, it’s best to not use IE as the default Browser for NetBeans, but to change to using the “Embedded WebKit Browser”, via the Project’s properties.