[英]How do i debug PHP in NetBeans
I would like to turn on the debugger, I imagined that either: 我想打开调试器,我想到了:
I have been changing various bits and bobs trying to get the debugger to work in NetBeans All of which seems to have been in the php.ini file: 我一直在改变各种细节,试图使调试器在NetBeans中工作。所有这些似乎都在php.ini文件中:
zend_extension = "c:/wamp/bin/php/php5.4.16/zend_ext/php_xdebug-2.2.3-5.4-vc9.dll"
[xdebug]
xdebug.remote_enable = off
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "c:/wamp/tmp"
I really do not understand what the above is doing but I've been following tutorial after tutorial and getting no where. 我真的不明白上面的操作,但是我一直在一个教程接一个教程地学习,却一无所获。
What ends up happening is that I press the run button in Netbeans, the debugger part keeps saying connecting, while my browser has already loaded the page and presented everything, ignoring the fact I wanted to break at a point. 最终发生的事情是,我按了Netbeans中的运行按钮,调试器部分一直在说连接,而我的浏览器已经加载了页面并显示了所有内容,而忽略了我想中断的事实。
Any ideas? 有任何想法吗?
When you install netbeans it automatically adds these lines to your PHP.ini file (C:\\wamp\\bin\\apache{your-version-of-apache}\\bin\\php.ini), as James has described. 如James所述,在安装netbeans时,它会自动将这些行添加到您的PHP.ini文件(C:\\ wamp \\ bin \\ apache {您的版本的Apache} \\ bin \\ php.ini)中。
To fix the issue of netbeans saying "waiting for connection to netbeans-xdebug" follow the few steps bellow. 要解决netbeans说“等待连接到netbeans-xdebug”的问题,请遵循以下几步。
Remove the lChange the following lines in the php.ini file to 删除l将php.ini文件中的以下行更改为
zend_extension = "c:/wamp/bin/php/php5.4.16/zend_ext/php_xdebug-2.2.3-5.4-vc9.dll" zend_extension =“ c:/wamp/bin/php/php5.4.16/zend_ext/php_xdebug-2.2.3-5.4-vc9.dll”
[xdebug] [Xdebug的]
xdebug.remote_enable = 1 xdebug.remote_enable = 1
xdebud.idekey="netbeans-xdebug" xdebud.idekey = “netbeans的-Xdebug的”
xdebug.profiler_enable = 1 xdebug.profiler_enable = 1
In netbeans click tools > Options > php > debugging 在netbeans中,单击工具>选项> php>调试
Make sure the debugger port is 9000 and session id is netbeans-xdebug 确保调试器端口为9000,会话ID为netbeans-xdebug
I had a similar issue and came across a post to fix the problem. 我遇到了类似的问题,并且遇到了一个帖子来解决该问题。 My html form (testform.html) was calling a php script (runQuery.php) and Netbeans could not break at the set break points in my runQuery.php
我的html表单(testform.html)正在调用php脚本(runQuery.php),而Netbeans无法在runQuery.php中的设置断点处中断
After checking all the configuration settings in php.ini and Netbeans by searching on forums like this one, I discovered that netbeans will only break on the break points if the Index file for the project is a PHP file. 通过在类似这样的论坛上进行搜索来检查php.ini和Netbeans中的所有配置设置之后,我发现如果项目的索引文件是PHP文件,则netbeans仅会在断点处中断。 This is very important otherwise you will spend hours trying to figure out why break points are not working.
这非常重要,否则您将花费数小时来尝试找出断点为何不起作用的原因。
In Netbeans go into the File/Project Properties/Run Configuration and check that the Index file is a PHP file. 在Netbeans中,进入文件/项目属性/运行配置,然后检查索引文件是否为PHP文件。 In my case I changed my index file from testform.html to testform.php and it worked, I was able to break on break points.
就我而言,我将索引文件从testform.html更改为testform.php,并且它可以正常工作,我能够在断点处中断。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.