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.
我希望使用不同计算机的团队能够在远程服务器上调试PHP,但是我很难让Xdebug在NetBeans 7.0.1中工作。我试过很多网上技巧,但都没用。
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.
我已经成功地在运行WampServer的Windows 7机器上本地安装了Xdebug。因此,如果我将项目属性—>运行配置—>作为属性运行到本地Web站点,那么我可以使用NetBeans中的断点来调试PHP。然而,如上所述,我的目标是在远程Web站点上的NetBeans中进行调试。
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:
我的服务器是Ubuntu 11.04机器。我使用了http://www.xdebug.org/find-binary.php的输出,将正确的二进制文件放到机器上。我已经修改了所有的php。我可以找到的ini文件(在php5/apache2和php5/cli目录中)包括以下几行:
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
If I check the phpinfo.php
web page, it says:
如果我检查phpinfo。php网页,它说:
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
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似乎是正确安装的。但是,当我尝试在NetBeans中调试时,我得到了等待连接的无休止的状态条消息(NetBeans -xdebug)。当我点击停止按钮时,在X秒内检测到xdebug没有连接。原因可能是xdebug没有安装或配置不当。
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.
也许我把本地设置和服务器设置搞混了?一篇文章xdebug说。remote_host应该设置为运行NetBeans的机器的IP,但是我希望团队能够使用具有不同IP地址的机器进行调试。一个问题可能是端口9000,但是我检查过它没有被阻塞。
Any help that could clarify this would be appreciated!
任何可以澄清这一点的帮助都将是感激的!
7 个解决方案
#1
35
The server running PHP (and XDebug) needs to be able to connect to your workstation/desktop.
运行PHP(和XDebug)的服务器需要能够连接到您的工作站/桌面。
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.
因此,您需要相应地设置服务器,要么告诉它连接到特定的ip地址(xdebug.remote_host),要么自动“连接回来”(xdebug.remote_connect_back)。不过,后者也有一些安全方面的影响。这些在手册中有概述。
#2
14
The key directive is this:
关键指令是:
xdebug.remote_connect_back = On
This allows the web server to connect to whatever computer is asking for a debugging session. This way you don't have to hard-code an IP address and are able to share Xdebug. This directive was not present in earlier versions and is often omitted from tutorials and documentation.
这允许web服务器连接到任何需要调试会话的计算机。通过这种方式,您不必硬编码IP地址,并且能够共享Xdebug。该指令在早期版本中没有出现,在教程和文档中经常被忽略。
You also need to verify that every client computer accepts incoming connections to port 9000 (xdebug.remote_port
). This includes configuring the firewall and making sure the debugger client is up and running
您还需要验证每个客户机计算机是否接受到端口9000 (xdebug.remote_port)的传入连接。这包括配置防火墙和确保调试器客户端已经启动并运行
#3
11
For me does xdebug.remote_connect_back = On
not work. What I did, was set ssh port forwarding on my client machine.
对我来说xdebug。remote_connect_back =不工作。我所做的是在我的客户端机器上设置ssh端口转发。
xdebug config on the remote machine:
远程机器上的xdebug配置:
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.remote_handler = dbgp
xdebug.remote_mode = req
forward ports on the client machine:
客户端机器上的转发端口:
ssh -g -N -lusername -R9000:127.0.0.1:9000 [remote.host.ip]
The shell access on the remote machine must be allowed.
必须允许远程机器上的shell访问。
#4
4
In my case, those commands helped me:
就我而言,这些命令帮助了我:
xdebug.remote_enable = On
xdebug.remote_autostart=1
Notice: the debugger will work even if GET/POST/COOKIE variable is not present because of 'xdebug.remote_autostart=1'
注意:即使因为“xdebug.remote_autostart=1”而没有出现GET/POST/COOKIE变量,调试器仍然可以工作。
#5
0
What page extension are you firing up to start debugging? I remember I went nuts and spent sleepless nights where all settings with XDebug are going great. The problem was I was not starting up with .PHP
rather starting up with .HTML
.
您正在启动哪个页面扩展以开始调试?我记得我发疯了,度过了无数个不眠之夜,所有的XDebug设置都运行得很好。问题是我没有开始使用。php,而是用。html。
If you are then try starting up your debugging with .PHP
file.
如果正在调试,请尝试使用. php文件启动调试。
#6
0
You will need set:
您将需要设置:
xdebug.remote_host=192.168.1.104
192.168.1.104
is the client's ip, where you working with the IDE
192.168.1.104是客户端的ip,您在其中使用IDE
#7
0
Thanks for xdebug.remote_connect_back = On
on server side php.ini
Also I had to use this plugin for Chrome to be able to start debugging session in PhpStorm
谢谢xdebug。在服务器端php上的remote_connect_back =。我还必须使用Chrome的这个插件才能在PhpStorm中开始调试会话
#1
35
The server running PHP (and XDebug) needs to be able to connect to your workstation/desktop.
运行PHP(和XDebug)的服务器需要能够连接到您的工作站/桌面。
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.
因此,您需要相应地设置服务器,要么告诉它连接到特定的ip地址(xdebug.remote_host),要么自动“连接回来”(xdebug.remote_connect_back)。不过,后者也有一些安全方面的影响。这些在手册中有概述。
#2
14
The key directive is this:
关键指令是:
xdebug.remote_connect_back = On
This allows the web server to connect to whatever computer is asking for a debugging session. This way you don't have to hard-code an IP address and are able to share Xdebug. This directive was not present in earlier versions and is often omitted from tutorials and documentation.
这允许web服务器连接到任何需要调试会话的计算机。通过这种方式,您不必硬编码IP地址,并且能够共享Xdebug。该指令在早期版本中没有出现,在教程和文档中经常被忽略。
You also need to verify that every client computer accepts incoming connections to port 9000 (xdebug.remote_port
). This includes configuring the firewall and making sure the debugger client is up and running
您还需要验证每个客户机计算机是否接受到端口9000 (xdebug.remote_port)的传入连接。这包括配置防火墙和确保调试器客户端已经启动并运行
#3
11
For me does xdebug.remote_connect_back = On
not work. What I did, was set ssh port forwarding on my client machine.
对我来说xdebug。remote_connect_back =不工作。我所做的是在我的客户端机器上设置ssh端口转发。
xdebug config on the remote machine:
远程机器上的xdebug配置:
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.remote_handler = dbgp
xdebug.remote_mode = req
forward ports on the client machine:
客户端机器上的转发端口:
ssh -g -N -lusername -R9000:127.0.0.1:9000 [remote.host.ip]
The shell access on the remote machine must be allowed.
必须允许远程机器上的shell访问。
#4
4
In my case, those commands helped me:
就我而言,这些命令帮助了我:
xdebug.remote_enable = On
xdebug.remote_autostart=1
Notice: the debugger will work even if GET/POST/COOKIE variable is not present because of 'xdebug.remote_autostart=1'
注意:即使因为“xdebug.remote_autostart=1”而没有出现GET/POST/COOKIE变量,调试器仍然可以工作。
#5
0
What page extension are you firing up to start debugging? I remember I went nuts and spent sleepless nights where all settings with XDebug are going great. The problem was I was not starting up with .PHP
rather starting up with .HTML
.
您正在启动哪个页面扩展以开始调试?我记得我发疯了,度过了无数个不眠之夜,所有的XDebug设置都运行得很好。问题是我没有开始使用。php,而是用。html。
If you are then try starting up your debugging with .PHP
file.
如果正在调试,请尝试使用. php文件启动调试。
#6
0
You will need set:
您将需要设置:
xdebug.remote_host=192.168.1.104
192.168.1.104
is the client's ip, where you working with the IDE
192.168.1.104是客户端的ip,您在其中使用IDE
#7
0
Thanks for xdebug.remote_connect_back = On
on server side php.ini
Also I had to use this plugin for Chrome to be able to start debugging session in PhpStorm
谢谢xdebug。在服务器端php上的remote_connect_back =。我还必须使用Chrome的这个插件才能在PhpStorm中开始调试会话