How to debug PHP with netbeans and Xdebug

2019-01-21 15:04发布

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)

16条回答
贪生不怕死
2楼-- · 2019-01-21 15:32

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.

查看更多
孤傲高冷的网名
3楼-- · 2019-01-21 15:35

It's not a know problem that xdebug gives issues with curl or mod_rewrite. The only issues I am aware of is with Xdebug on Vista.

查看更多
做个烂人
4楼-- · 2019-01-21 15:36

If you are using xampp under Windows:

You only need to open your php.ini file and change these two lines

;xdebug.profiler_enable = 0
;zend_extension = "C:\xampp\php\ext\php_xdebug.dll"

into

xdebug.profiler_enable = 1
zend_extension = "C:\xampp\php\ext\php_xdebug.dll"

(Caution: If your xampp version is old, you must download it from http://xdebug.org/download.php, download the 32 bit even your OS is 64 bit. E.g. the xdebug's name you downloaded is php_xdebug-2.2.1-5.4-vc9.dll. First copy php_xdebug-2.2.1-5.4-vc9.dll to the directory C:\xampp\php\ext\, then your the second line will be zend_extension = "C:\xampp\php\ext\php_xdebug-2.2.1-5.4-vc9.dll)

After that stop apache and start again, that's it.

查看更多
太酷不给撩
5楼-- · 2019-01-21 15:39

Go to http://wiki.netbeans.org/HowToConfigureXDebug . There is a big list of steps you should follow, that might help you out.

But most likely you just need a new version of xdebug-binary. Go to http://xdebug.org/wizard.php to find out what binary you need und your problem might be solved.

查看更多
The star\"
6楼-- · 2019-01-21 15:40

You can see here: http://ruilima.com/2010/11/ambiente_de_desenvolvimento_php_netbeans_xdebug/ is in Portuguese, but there is a pre configured virtual machine with Ubuntu 10.10, netbeans, php, mysql, xdebug, ready to use. take a look

查看更多
欢心
7楼-- · 2019-01-21 15:43

I found out that in Netbeans you need to set the webroot path in the projects to app/webroot. If you do this debugging works flawlessly.

查看更多
登录 后发表回答