EC2实例(与Ubuntu 12.04一起)安装了Apache 2.4.6和Php 5.5.6+xDebug 2.2.2。Apache和Php是使用make构建的。除了xDebug之外,一切都很好。
日志文件和php.ini 的内容
php.ini
zend_extension="/opt/php/lib/php/extensions/no-debug-zts-20121212/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.idekey=xdebug
xdebug.remote_port=9000
xdebug.remote_connect_back=1
xdebug.remote_log="/tmp/xdebug_remote_log.log"
xdebug.extended_info=1
/tmp/xdebug_remote_log.log
Log opened at 2013-11-29 13:18:35
I: Checking remote connect back address.
I: Remote address found, connecting to 117.197.126.1:9000.
E: Could not connect to client. :-(
Log closed at 2013-11-29 13:18:36
我在本地CentOS 6.3机器上安装了完全相同的Apache 2.4.6和PHP 5.5.6,运行良好。
根据连接到EC2实例的方式,您可能必须在计算机和EC2之间打开一个隧道。如果您在工作或家中无法将端口9000从EC2重定向到您的计算机(出于任何原因,如安全、无法打开路由器中的端口等),则会出现这种情况。
从您的计算机(OSX或Linux)打开SSH隧道:
ssh -N -R 9000:localhost:9000 ubuntu@domain_or_ip
假设您已经安装了php5-xdebug,请在php.ini的末尾添加以下行:
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_mode = req
xdebug.remote_host = 127.0.0.1
xdebug.remote_port = 9000
并重新启动apache:
service apache2 restart
端口9000应该成功重定向到netbeans(如果您使用netbeans)或支持xdebug 的编辑器
希望这能帮助
是我的DLink路由器阻止了任何入站连接请求。
设置端口转发解决了此问题。
注意:仅为入站连接设置所需端口。
别忘了重新启动:
sudo service httpd restart