Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug PHP with netbeans and Xdebug

I have recently tried to get going with Netbeans 6.5 after it rated so highly in the IDE review by Smashing magazine. http://www.smashingmagazine.com/2009/02/11/the-big-php-ides-test-why-use-oneand-which-to-choose/

My main reason for switching from Notepad++ is that I'd like to be able to debug my code and set through it.

I have followed the instructions about how to install xdebug from both the vendor http://xdebug.org/ and the netbeans web site. http://www.netbeans.org/kb/docs/php/debugging.html#gettingReady but to no avail.

How is it done, has anyone else got debugging working in netbeans?

(My setup is: Windows XP, Wamp server 2.0, PHP 5, Netbeans 6.5.1)

like image 530
Jon Winstanley Avatar asked Mar 28 '09 16:03

Jon Winstanley


People also ask

Can you code PHP in NetBeans?

Using Database Servers with NetBeans IDE for PHPYou can use various database servers with the NetBeans IDE for PHP, although the most popular is the MySQL server.


2 Answers

It's important to add this line in the php.ini:

xdebug.idekey="netbeans-xdebug"

Note: In NetBeans go to Settings and look where the xdebug stuff is set up. Look for that Session ID. In my case it was netbeans-xdebug.

like image 76
openfrog Avatar answered Oct 05 '22 19:10

openfrog


hm, for me, the netbeans was the first ide that php debugging was working out of the box.

Does the xdebug show in phpinfo? if it does it should work with default settings. the only one that is needed is:

xdebug.remote_enable=on

So if this isn't enabled put it in your php.ini file, restart apache, and debugging should work.

If not, you will have to supply more info for me to help you.

sy

like image 33
deresh Avatar answered Oct 05 '22 20:10

deresh