Tag Archives: xdebug

[HOWTO] Setup step debugging PHP in Netbeans on Windows with XAMPP

I am using Netbeans 6.9.1 on Windows 7 with XAMPP 1.7.4 installed. I wanted to enable step debugging for PHP like I do in my PC with Fedora (see here for Netbeans PHP step debugging for Fedora). To do that, I had to follow the following steps:

Edit the php.ini file (xampp\php\php.ini) in a text editor to uncomment (remove leading semicolon 😉 the following lines:

zend_extension = "D:\xampp\php\ext\php_xdebug.dll"
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "localhost"
xdebug.remote_port = 9000

Also, search for the line containing “xdebug.remote_enable” and change it to:

xdebug.remote_enable = On

Then restart apache service.

Now, open the file Program Files\NetBeans 6.9.1\etc\netbeans.conf and find the line containing “netbeans_default_options”. Add the text “-J-Dorg.netbeans.modules.php.dbgp.level=400” at the end of the line so that it looks like the following:

netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-XX:MaxPermSize=200m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dorg.netbeans.modules.php.dbgp.level=400"

Now, restart Netbeans and select Debug>Debug Project. However, I have experienced it is very slow on Windows compared to the installation on Fedora.

Hope this helps.

[HOWTO] Configure Netbeans 6.9 to debug PHP files using xdebug in Fedora 14

I am using Netbeans 6.9 on Fedora 14 for Web development. I have enabled PHP debugging for making PHP development easier. Here is how you can do it too.

Install and enable xdebug

Use yum to install php-pecl-xdebug:

sudo yum install php-pecl-xdebug

Now, open the file /etc/php.d/xdebug.ini in a text editor as root. I use nano:

sudo nano /etc/php.d/xdebug.ini 

Now , make sure the following options are set enabled in ini:

; Enable xdebug extension module
zend_extension=/usr/lib/php/modules/xdebug.so
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000

Allow port for xdebug

sudo semanage port -a -t http_port_t -p tcp 9000 

Restart Apache:

sudo service httpd restart

Configure Netbeans to use PHP debugger

Now, open up the file /usr/share/netbeans/6.9/etc/netbeans.conf in a text editor and add the text “-J-Dorg.netbeans.modules.php.dbgp.level=400” in netbeans_default_options so that the line looks somewhat like this:

netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-XX:MaxPermSize=200m -J-Dapple.laf.useScreenMenuBar=true -J-Dsun.java2d.noddraw=true -J-Dorg.netbeans.modules.php.dbgp.level=400"

Restart netbeans and given that you have configured the project directories properly, you should be able to click on the debug button and start debugging PHP file.