php Netbeans 等待连接到 XDEBUG

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20277240/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 03:01:23  来源:igfitidea点击:

Netbeans waiting for connection to XDEBUG

phpnetbeansxdebug

提问by Pixy

Netbeans won't connect to xdebug. I've tried suggestions from the following posts:

Netbeans 不会连接到 xdebug。我已经尝试了以下帖子中的建议:

Debugging IDE's port connection to XDebug: "Waiting to Connect"

调试 IDE 与 XDebug 的端口连接:“Waiting to Connect”

netbeans shows "Waiting For Connection (netbeans-xdebug)"

netbeans 显示“等待连接(netbeans-xdebug)”

but it doesn't fix my issue.

但它不能解决我的问题。

It seems Netbeans connects to xdebug because while it waits for the connection all request made to the webserver [Apache2] are blocked. Also the port [9001] appears to be in use:

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: [I have confirmed it is loaded in phpinfo()]

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 configuration:

Netbeans 配置:

Debugger port: 9001
Session ID: netbeans-xdebug
Stop at first line: Checked
All other options are unchecked

Project properties:

项目属性:

Host: 127.0.0.1
Port: 9001

Edit: I've noticed Netbeans doesn't append the XDEBUG_SESSION_STOP to the URL. I don't think this is related to the issue because Netbeans only opens the page after I close the debugging session.

编辑:我注意到 Netbeans 没有将 XDEBUG_SESSION_STOP 附加到 URL。我认为这与该问题无关,因为 Netbeans 仅在我关闭调试会话后才打开页面。

I've also disabled SELinux

我也禁用了 SELinux

回答by Leonardo Saracini

On Ubuntu 13.04 64bit php 5.4.9-4 Xdebug v2.2.3 netbeans 7.4
I have same problem and have solve it by:
1. go on http://xdebug.org/wizard.phpfollow the instructions to compile your own xdebug.so
2. in netbean 7.4 general options (sorry I haven't reputation 10 to post image) test connection. be sure correct settings on Proxy: to me "No Proxy" is working.
3. in php options debugging tab change xdebug setting port to other than 9001 or 9000. I choose 9002 but you can try until you find a free port (if port is not free nb tell you)
4. in php.ini ORfor ubuntu usersin /etc/php5/conf.d/20-xdebug.ini

在 Ubuntu 13.04 64bit php 5.4.9-4 Xdebug v2.2.3 netbeans 7.4 上
我有同样的问题并已通过以下方式解决:
1. 继续访问http://xdebug.org/wizard.php,按照说明编译您自己的 xdebug。所以
2. 在 netbean 7.4 常规选项中(对不起,我没有信誉 10 发布图片)测试连接。确保代理上的设置正确:对我来说“无代理”正在工作。
3.在PHP选项调试选项卡中的XDebug改变设置端口为除9001或9000。我选择了9002,但你可以尝试,直到找到一个空闲端口(如果端口是不是免费的NB告诉你)
4.在php.ini ORUbuntu的/etc/php5/conf.d/20-xdebug.ini 中的 用户

zend_extension=/usr/lib/php5/20100525/xdebug.so #where you ave put your reconpiled xdebug.so
[xdebug]
xdebug.remote_autostart=0
xdebug.remote_enable=1
xdebug.remote_handler="dbgp"
xdebug.remote_mode="req"
xdebug.remote_port=9002 # the port you have found free and set in netbeans above
xdebug.remote_host=127.0.0.1
xdebug.profiler_enable=0
xdebug.profiler_output_dir="/tmp/"
xdebug.idekey="netbeans-xdebug"
xdebug.remote_log="/home/#user_name#/xdebug.log" #your user name

zend_extension=/usr/lib/php5/20100525/xdebug.so #你把重新编译的xdebug.so放在哪里
[xdebug]
xdebug.remote_autostart=0
xdebug.remote_enable=1
xdebug.remote_handler="dbgp"
xdebug.remote_mode "
xdebug.remote_port=9002 # 你在 netbeans 上面找到的空闲端口
xdebug.remote_host=127.0.0.1
xdebug.profiler_enable=0
xdebug.profiler_output_dir="/tmp/"
xdebug.idekey="netbeans-xdebug"
xdebug. remote_log="/home/#user_name#/xdebug.log" #您的用户名

5. sudo service apache2 restart

5. sudo 服务 apache2 重启

after do this I can debug php again.

完成此操作后,我可以再次调试 php。

回答by Steffomio

Had same issue:

有同样的问题:

$ netstat | grep 9000
...
tcp6       1      0 localhost:9000          localhost:37486         CLOSE_WAIT

Solution: Restart NetBeans. There was running a dead Process waiting for connections.

解决方案:重新启动 NetBeans。正在运行一个等待连接的死进程。

Here Netbeans with a running debug session. Note the CLOSE_WAITand TIME_WAIT.

这里有一个正在运行的调试会话的 Netbeans。注意CLOSE_WAITTIME_WAIT

tcp6       0      0 localhost:9000          localhost:38166         TIME_WAIT 

回答by onlyme

I had the same issue and I have tried many solution i had found out there but the issue still occured. I have tried to follow the step discribe in enter link description here

我遇到了同样的问题,我尝试了很多我在那里找到的解决方案,但问题仍然存在。我试图按照此处输入链接描述中的步骤描述

and

enter link description here

在此处输入链接描述

And that , whttp://localhost/abc/trunk/abc/backend/web/?XDEBUG_SESSION_START=netbeans-xdebughen i debug my project, my netbeats still waiting connection till i have to had the following "?XDEBUG_SESSION_START=netbeans-xdebug" in my url as http://localhost/abc/trunk/abc/backend/web/?XDEBUG_SESSION_START=netbeans-xdebugso netbeans was able to connect with xdebug

那,whttp://localhost/abc/trunk/abc/backend/web/?XDEBUG_SESSION_START=netbeans-xdebughen 我调试我的项目,我的 netbeats 仍在等待连接,直到我必须有以下“?XDEBUG_SESSION_START=netbeans-xdebug”在我的 url 中作为http://localhost/abc/trunk/abc/backend/web/?XDEBUG_SESSION_START=netbeans-xdebug所以 netbeans 能够与 xdebug 连接

回答by treefiddy

**On Windows 10 with Netbeans 8.0 running Netbeans built in webserver **

**在带有 Netbeans 8.0 的 Windows 10 上运行内置网络服务器的 Netbeans **

The following options in the php.ini file resolved the issue for me:

php.ini 文件中的以下选项为我解决了这个问题:

zend_extension ='C:\path to php installation\ext\php_xdebug-2.5.0-5.6-vc11.dll' xdebug.remote_enable=on

zend_extension ='C:\php安装路径\ext\php_xdebug-2.5.0-5.6-vc11.dll' xdebug.remote_enable=on

This issue for me seemed to be resolved by using the full path to the .dll file. Also, because I had spaces in the path name I had to enclose the path in quotes (double vs single did not seem to matter). Also, I had to set the xdebug.remote_enable option. Once I set both options, I was able to select the Debug Application option within Netbeans and the debugger started.

对我来说,这个问题似乎可以通过使用 .dll 文件的完整路径来解决。另外,因为路径名中有空格,所以我不得不用引号将路径括起来(双与单似乎无关紧要)。另外,我必须设置 xdebug.remote_enable 选项。一旦我设置了这两个选项,我就可以在 Netbeans 中选择“调试应用程序”选项并启动调试器。

回答by Naseeruddin V N

i was facing a similar problem, in my case i had recently update my php version and the xdebug configuration were in the only php5 folder. had simply had to copy the old xdebug configuration to the new php.ini file of the new version and it worked like before.

我遇到了类似的问题,就我而言,我最近更新了我的 php 版本,并且 xdebug 配置位于唯一的 php5 文件夹中。只需要将旧的 xdebug 配置复制到新版本的新 php.ini 文件中,它就可以像以前一样工作。

some of the tips to debug this are:

调试此问题的一些技巧是:

  1. first check if xdebug is install, run (php -v) if xdebug details aren't there then install and add the configuration.
  2. open phpinfo() under xdebug category check if xdebug configuration is loaded.Check for the following settings.
    • remote_enable = on,remote_handler=dbgp
  1. 首先检查是否安装了 xdebug,如果 xdebug 详细信息不存在,则运行 (php -v) 然后安装并添加配置。
  2. 打开 xdebug 类别下的 phpinfo() 检查是否加载了 xdebug 配置。检查以下设置。
    • remote_enable = on,remote_handler=dbgp