Xdebug的远程服务器未连接 [英] Xdebug for remote server not connecting
问题描述
我希望使用不同计算机的团队能够在远程服务器上调试PHP,但是我很难让Xdebug在NetBeans 7.0.1中工作.我尝试了许多在线提示,但无济于事.
I want a team using different computers to be able to debug PHP on a remote server, but I am having a hard time getting Xdebug to work in NetBeans 7.0.1. I’ve tried many online tips, but to no avail.
作为记录,我已经在运行WampServer的Windows 7计算机上成功地在本地安装了Xdebug.因此,只要将 Project Properties-> Run Configuration-> Run As 属性设置为 Local Web Site ,我就可以在NetBeans中使用断点调试PHP. .但是,如上所述,我的目标是在远程网站上的NetBeans中进行调试.
For the record, I have successfully installed Xdebug locally on a Windows 7 machine running WampServer. So I can debug PHP with breakpoints in NetBeans, provided I set the Project Properties->Run Configuration->Run As property to Local Web Site. However, as stated above my goal is to debug in NetBeans on a Remote Web Site.
我的服务器是Ubuntu 11.04计算机.我已经使用了 http://www.xdebug.org/find-binary.php 的输出将正确的二进制文件放在计算机上.我已经修改了我可以找到的所有php.ini
文件(在php5/apache2
和php5/cli
目录中)以包括以下行:
My server is a Ubuntu 11.04 machine. I have used the output from http://www.xdebug.org/find-binary.php to put the proper binary on the machine. I have modified all php.ini
files I could find (in both the php5/apache2
and php5/cli
directories) to include these lines:
zend_extension="/usr/lib/php5/20090626+lfs/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
如果我查看phpinfo.php
网页,则显示:
If I check the phpinfo.php
web page, it says:
This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Xdebug v2.1.2, Copyright (c) 2002-2011, by Derick Rethans
因此Xdebug似乎已正确安装.不过,当我尝试在NetBeans中进行调试时,会收到无休止的状态栏消息等待连接(netbeans-xdebug).当我按下停止按钮时,我得到在X秒内未检测到来自xdebug的连接.原因可能是未安装xdebug或配置不正确.
So Xdebug does seem to be installed properly. Still, when I try debugging in NetBeans, I get the endless status bar message Waiting For Connection (netbeans-xdebug). When I hit the stop button I get No connection from xdebug was detected within X seconds. The reason could be that xdebug is not installed or not properly configured.
也许我在这里将本地设置与服务器设置混淆了? 帖子说xdebug.remote_host
应该设置为运行NetBeans的计算机的 IP ,但我希望团队能够使用具有不同IP地址的计算机进行调试.问题可能是端口9000,但是我已经检查了它是否被阻止.
Maybe I'm confusing local settings with server settings here? A post said xdebug.remote_host
should be set to the IP of the machine running NetBeans, but I want a team to be able to debug using machines with different IP addresses. A problem could be port 9000, but I have checked that it is not blocked.
任何可以阐明这一点的帮助将不胜感激!
Any help that could clarify this would be appreciated!
推荐答案
运行PHP(和XDebug)的服务器必须能够连接到您的工作站/台式机.
The server running PHP (and XDebug) needs to be able to connect to your workstation/desktop.
因此,您需要通过告诉服务器连接到特定于 的IP地址(xdebug.remote_host
)或自动重新连接"(xdebug.remote_connect_back
)来进行服务器的相应设置.但是,后者有一些安全隐患.手册中概述了这些.
So you'll need the server set up accordingly by either telling it to connect to a specific IP-address (xdebug.remote_host
) or to automatically "connect back" (xdebug.remote_connect_back
). The latter has some security implications, though. These are outlined in the manual.
这篇关于Xdebug的远程服务器未连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!