Xdebug和Netbeans问题 [英] Xdebug And Netbeans Problem

查看:148
本文介绍了Xdebug和Netbeans问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试配置xdebug以与Netbeans 6.9和php 5.3一起使用
就我而言,我已经正确设置了xdebug.
我可以从phpinfo页面看到xdebug扩展名.
我读过其他文章并尝试了他们的建议,但无济于事

Im trying to configure xdebug to work with Netbeans 6.9 and php 5.3
As far as i concern i have setup xdebug properly.
I can see xdebug extension from phpinfo page.
I have read other post and tried their suggestion but up to no avail

当我按下调试按钮时,它将直接在浏览器中打开页面,并且在netbeans的底部窗格中可以看到消息等待连接"

When i hit the debug button, it straight open the page in the browser and i can see message 'Waiting for connection' in the bottom pane of netbeans

这是我在php.ini中的设置

Here my setting in php.ini

zend_extension = /usr/lib/php5/20090626+lfs/xdebug.so
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey="netbeans-xdebug"

任何帮助将不胜感激

推荐答案

首先,检查它实际上是否对您有用,并且您没有注意到.我已经做到了……坚信它不起作用,我浪费了很多时间试图使它起作用,只是发现一切都很好.

First, check that it isn't actually working for you, and you don't notice. I've done this...convinced it's not working I wasted a chunk of time trying to get it to work, only to find that everything was OK.

查看您的NetBeans状态栏.如果看到"netbeans-xdebug"和"running",那么它实际上可以正常工作.您可能已关闭了在第一行停止"选项,并且尚未达到设置的任何断点(如果有).这就是您在看到该页面时几乎没有或没有任何迹象表明调试器已实际连接的原因.

Look at your NetBeans status bar. If you see "netbeans-xdebug" and "running" then it is actually working just fine. You probably have the "Stop at first line" option turned off and you didn't hit any breakpoints you set (if any) yet. That would be a reason you are seeing the page with little or no indication that the debugger is actually connected.

如果相反地看到正在等待连接(netbeans-xdebug)"并且进度条正在循环,则说明您确实没有连接.打开工具" |选项",然后转到"PHP"页面.在常规"选项卡上,确保调试器端口"为9000,会话ID"为"netbeans-xdebug".您可能需要选中在第一行停止".我没有,因为我觉得这有点烦人.我一定会确保未选中手表和气球评估".此选项导致NetBeans和调试器不稳定.如果需要监视,请在需要的地方将局部变量入侵到PHP代码中,并在调试器运行时在变量"选项卡上看到它.另外,请确认在项目的运行配置">索引文件"中指定了文件(index.php).

If you instead see "Waiting for Connection (netbeans-xdebug)" and the progress bar is cycling, then you are indeed not connected. Open Tools|Options, and go to the PHP page. On the general tab, make sure that the "Debugger port" is 9000 and the "Session ID" is "netbeans-xdebug". You may want to have "Stop at First Line" checked. I don't, as I find it a bit annoying. I would definitely ensure that "Watches and Balloon Evaluation" is not checked. This option causes NetBeans and the debugger to destabilize. If you need a watch, hack a local variable into the PHP code where you need it, and you'll see it on the "Variables" tab when the debugger is running. Also, confirm that file (index.php) is specified in the project's Run Configuration > Index File.

由于您在phpinfo()中看到xdebug,所以它的末尾就可以了.只要确保所有值看起来都合理,并且在该页面上的某处有对cookie"XDEBUG_SESSION = netbeans-xdebug"的引用即可. (确保您没有在浏览器中关闭Cookie!)

Since you see xdebug in phpinfo(), that end of it is fine. Just make sure that all of the values look reasonable, and that there is some reference to a cookie "XDEBUG_SESSION=netbeans-xdebug" somewhere on that page. (Make sure that you don't have cookies turned off on the browser!)

要检查的唯一另一件事是查看是否正在运行某些防火墙/安全程序,该程序会在本地阻止TCP/UDP(这将是奇异的,但并非不可能),或者该端口是9000尚未被其他应用程序使用.由于某种原因,我在本地设置中使用了不同的端口号.我不记得要更改它,但是我敢肯定,我唯一的原因就是如果我与其他端口发生冲突.

The only other thing to check is to see if some firewall/security program is running that would be blocking TCP/UDP locally (which would be super-odd, but not out of the realm of possibility), or that port 9000 isn't already used by another application. I am using a different port number in my local setup for some reason. I don't remember changing it, but I am sure that the only reason I would have is if I had hit a port conflict with something else.

最后一件事...我们一直假设您正在同一台计算机上运行NetBeans和Web服务器.这是一种常见的配置,但不是唯一的配置.如果您的Web服务器在另一台计算机上,则将xdebug.remote_host=localhost中的 localhost 更改为运行NetBeans的计算机的IP地址.

One last thing... We've been assuming that you are running NetBeans and the web server on the same computer. That's a common configuration, but not the only one. If your web server is on a different computer, then change the localhost in xdebug.remote_host=localhost to the IP address of the computer on which NetBeans is running.

另一件事:当循环进行令人沮丧的迭代时,直到在phpinfo()中看到xdebug信息,然后重新启动apache/php.到达那里后,仍然在两次迭代之间重新启动NetBeans.信不信由你,重新启动您的浏览器.

Another last thing: When cycling through frustrating iterations, until you see xdebug info in phpinfo(), restart apache/php. Once there, still restart NetBeans between iterations. And believe it or not, restart your browser.

这篇关于Xdebug和Netbeans问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆