【发布时间】:2013-12-15 03:32:12
【问题描述】:
Netbeans 不会连接到 xdebug。我尝试了以下帖子的建议:
Debugging IDE's port connection to XDebug: "Waiting to Connect"
netbeans shows "Waiting For Connection (netbeans-xdebug)"
但这并不能解决我的问题。
Netbeans 似乎连接到 xdebug,因为在它等待连接时,向网络服务器 [Apache2] 发出的所有请求都被阻止了。端口 [9001] 似乎也在使用中:
roxy@Pixy011 ~ $ sudo nmap -sS -O 127.0.0.1
Starting Nmap 6.00 ( http://nmap.org ) at 2013-11-28 20:48 EST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000029s latency).
Not shown: 990 closed ports
PORT STATE SERVICE
22/tcp open ssh
139/tcp open netbios-ssn
443/tcp open https
445/tcp open microsoft-ds
631/tcp open ipp
902/tcp open iss-realsecure
3306/tcp open mysql
8080/tcp open http-proxy
8081/tcp open blackice-icecap
9001/tcp open tor-orport <---- Opened by java
xdebug.ini: [我已经确认它是在 phpinfo() 中加载的]
zend_extension=/usr/lib/php5/20100525/xdebug.so
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_handler="dbgp"
xdebug.remote_mode="req"
xdebug.remote_host="127.0.0.1"
xdebug.remote_port=9001
xdebug.idekey="netbeans-xdebug"
Netbeans 配置:
Debugger port: 9001
Session ID: netbeans-xdebug
Stop at first line: Checked
All other options are unchecked
项目属性:
Host: 127.0.0.1
Port: 9001
编辑: 我注意到 Netbeans 不会将 XDEBUG_SESSION_STOP 附加到 URL。我认为这与问题无关,因为 Netbeans 仅在我关闭调试会话后才打开页面。
我也禁用了 SELinux
【问题讨论】:
-
我花了一点时间调试它,最后发现问题是当netbeans启动xdebug时它转到HTTP://LOCALHOST?XDEBUG_SESSION_START=netbeans-xdebug并且有一个htaccess与重定向混淆。因此,将主机更改为 HTTP://LOCALHOST/index.php 导致它可以正常工作。所以HTTP://LOCALHOST/index.php?XDEBUG_SESSION_START=netbeans-xdebug
-
对我来说,我不知道有三个位置我必须指定端口 = 9000,并且不匹配导致“等待连接(netbeans-xdebug)”:stackoverflow.com/a/41768167/470749