启用PHP Xdebug remote_enable每次导致504超时

时间:2012-03-23 22:23:40

标签: timeout xdebug remote-debugging

我正在尝试正确设置Xdebug。使用这些设置,当我访问任何页面时,我在30秒后得到504超时错误。 (我使用的是ssh-tunnel,所以我使用remote_host 127.0.0.1)

zend_extension=/usr/lib/php5/20090626+lfs/xdebug.so
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_mode = req
xdebug.remote_host = 127.0.0.1
xdebug.remote_log = /home/ubuntu/xdebug-cgi.log
xdebug.idekey = "rsalazar"
xdebug.remote_port = 9000

一旦我能够获得此xdebug日志输出,由于某种原因它不再发布此输出:

> Log opened at 2012-03-23 22:13:50 I: Connecting to configured
> address/port: 127.0.0.1:9000. I: Connected to client. :-)
> -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
> fileuri="file:///home/ubuntu/www/info.php" language="PHP"
> protocol_version="1.0" appid="3119" idekey="rsalazar"><engine
> version="2.2.0rc1"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick
> Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2012 by Derick Rethans]]></copyright></init>

有什么想法吗?

编辑:我已经确定只有当我在页面上启用调试时才会发生这种情况(当然,当我打开'remote_autostart'时总是这样)...我想猜测xdebug正在等待服务器连接(?)

2 个答案:

答案 0 :(得分:2)

您是否在路由器中打开了端口9000?在我为入站和出站流量打开端口之前,我遇到了完全相同的问题。

答案 1 :(得分:0)

我遇到了同样的问题。我注意到,一旦我用sudo service apache2 reload重新加载apache,测试php脚本就可以绑定到端口9000的套接字。这暗示php在apache初创公司之后没有保持端口打开或继续监听。如果我找到了什么,会发布更多。