Thursday, December 23, 2010

Debugging PHP with XDebug and Netbeans

On ubuntu:
sudo apt-get install php5-xdebug

Edit xdebug.ini in /etc/php5/conf.d/xdebug.ini
#Add this line:

Restart apache:
sudo /etc/init.d/apache2 restart

In firefox, add extension "easy XDebug".
Restart firefox.

In netbeans, right click on project, "properties".
Go to "Run configuration", "Advanced"
Check on "Dot not open browser", "okay".
Click on "Debug", "Debug project"

Go to firefox, click on "Start XDebug session" icon, then open the URL to your local project.
Example: http://localhost/myprojectnamefolder/

You are done, you will notice debugging buttons on the top toolbar, on the right.
You may continue / step in / other action.

No comments: