How to debug PHP programs with XDebug and Notepad++?

XDebug provides a lot of useful information to a PHP programmer to debug code thus saving time and increasing efficiency.

As a first step, check the version of PHP you are running by creating phpinfo() in a file.

When the program is executed you will see a line of text showing the version of PHP you are using

This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies

Now that we know the version of PHP we are using, we can download the relevant xdebug version to to debug PHP programs with Notepad++

We will setup Notepad++ with xdebug and dbgp plugin.

Download from There is a custom installation steps link on xdebug home page that will help you identify which version of xdebug you need to download based on the information presented in phpinfo.

We will be downloading php_xdebug-2.1.2-5.2-vc6.dll to suite our php version in this example.

Copy the dll file into the extensions folder C:\wamp\bin\php\ext (or to a path that is accessible to webserver) so that the program gets identified by PHP engine.

Add the following set of lines under “Module settings” in php.ini (or at the bottom of php.ini file)

[xdebug] zend_extension_ts="c:/wamp/php/ext/php_xdebug-2.1.2-5.2-vc6.dll"
xdebug.profiler_output_dir = "c:/wamp/tmp/xdebug"

Restart apache web server so that the changes can be recognized.

Open the phpinfo page again. Now you can see Xdebug is successfully configured with php engine and it is ready for application profiling and remote debugging.

This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
with Xdebug v2.1.2, Copyright (c) 2002-2011, by Derick Rethans

Now we need to download dbgp plugin for Notepad++. Goto sourceforge for DBGP plugin download.

After download put the dll file into Notepad++ plugins folder C:\Program Files\Notepad++\plugins

Close and reopen Notepad++ and you can see DBGP plugin under “Plugins” option.

Select Plugins > DBGp > Config and set the following
Remote Server IP:
IDE KEY: xdebug
Remote Path: c:\wamp\www
Local Path: c:\wamp\www
Check the boxes for “Refresh local context on every step” and “Refresh global context on every step”.

To debug PHP programs, now write a program say mytest.php in the localhost and save it.

echo ”
XDebug – First program”;

for($i=0; $i{
echo “*”;
// Create a debug point after this line
if(($i % 10) == 0) echo “$”;

Open the program in Notepad++. Click “Plugins” > “DBGp”. DBGp trace window will open in the bottom of Notepad++.

Go to a line in the php program you just wrote where you want to debug and click the red round icon on DBGp panel to set the breakpoint.

Now execute the php program on the browser http://localhost/mytest.php and Notepad++ will start to blink indicating that the trace had started.


Written by kurinchilamp

Website: http://

Leave a Reply

Your email address will not be published. Required fields are marked *