php Xdebug 停止工作,我在哪里查找错误?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9964789/
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-26 07:59:50  来源:igfitidea点击:

Xdebug stopped working, where do I look for errors?

phpubunturesponsexdebug

提问by valk

I installed Xdebug and all was fine, until suddenly it stopped working. phpinfo() gives a nice XDebug output with all variables.

我安装了 Xdebug,一切都很好,直到它突然停止工作。phpinfo() 为所有变量提供了一个很好的 XDebug 输出。

php -m | grep deb

also gives twice XDebug (for Zend and PHP), so again looks just fine. My php.ini has these lines:

还提供了两次 XDebug(用于 Zend 和 PHP),所以看起来还不错。我的 php.ini 有以下几行:

zend_extension=/usr/lib/php5/20090626/xdebug.so
;extension=xdebug.so
xdebug.remote_host=localhost
xdebug.remote_enable=on
xdebug.remote_port=9001
xdebug.remote_handler=dbgp
xdebug.remote_connect_back=1

And yet, when running this code with should check XDebug (from Netbeans docs) it's just stuck. So No IDE is working with XDebug.

然而,当运行这段代码时,应该检查 XDebug(来自 Netbeans 文档)它只是卡住了。所以没有 IDE 与 XDebug 一起工作。

<?php
$address = '127.0.0.1';
$port = 9001;
$sock = socket_create(AF_INET, SOCK_STREAM, 0);
socket_bind($sock, $address, $port) or die('Unable to bind');
socket_listen($sock);
$client = socket_accept($sock);
echo "connection established: $client";
socket_close($client);
socket_close($sock);

Also, according to XDebug installation, I went twice throught the steps. What is wrong with my config? Thanks.

此外,根据 XDebug 安装,我通过这些步骤进行了两次。我的配置有什么问题?谢谢。

采纳答案by valk

At the end, left with only two solutions - to reinstall the Ubuntu OS or to install a new VM especially for xdebug, I'm going for the second one. Funny thing is, everything was working according to the "RTM" (f=freaking). One thing that I couldn't figure out is how to read the logs for XDebug in order to understand where the real problem is.

最后,只剩下两个解决方案 - 重新安装 Ubuntu 操作系统或安装一个新的 VM,特别是用于 xdebug,我将选择第二个。有趣的是,一切都按照“RTM”(f=freaking)运行。我无法弄清楚的一件事是如何读取 XDebug 的日志以了解真正的问题在哪里。

UPDATE

更新

After some struggling, I deleted every single line related to xdebug from every php.ini that I had. And moved these lines to /etc/php5/conf.d/xdebug.ini. Restarted Apache, and then PHPStorm, and it works. P.S. in the middle, I tried to install xdebug with pecl, from github, and the standard Ubuntu version. I think the one that I compiled is currently working. And.. the log gets updated as well.

经过一番挣扎,我从我拥有的每个 php.ini 中删除了与 xdebug 相关的每一行。并将这些行移至 /etc/php5/conf.d/xdebug.ini。重新启动Apache,然后PHPStorm,它可以工作。PS在中间,我尝试使用pecl,从github和标准的Ubuntu版本安装xdebug。我认为我编译的那个目前正在运行。而且..日志也会更新。

;xdebug configuration
zend_extension = /usr/lib/php5/20090626/xdebug.so
xdebug.remote_host = 127.0.0.1
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.remote_handler = dbgp
xdebug.remote_mode = req
xdebug.profiler_enable=0
xdebug.profiler_enable_trigger=1
xdebug.remote_autostart=1
xdebug.idekey=PHPSTORM
xdebug.remote_log="/tmp/xdebug.log"

回答by Derek Illchuk

On your server, try this command:

在您的服务器上,尝试以下命令:

$ netstat -anp | grep CLOSE_WAIT

$ netstat -anp | grep CLOSE_WAIT

Any :9000 entries will give you XDebug troubles; consider kill -9 <pid>.

任何 :9000 条目都会给您带来 XDebug 麻烦;考虑kill -9 <pid>

回答by Michael Gorham

I had this problem too on Ubuntu after updating php. For me, turning on html errors in php.ini got xdebug with Netbeans to work again ...

更新 php 后,我在 Ubuntu 上也遇到了这个问题。对我来说,打开 php.ini 中的 html 错误使 xdebug 与 Netbeans 再次工作......

sudo vi /etc/php5/apache2/php.ini
display_errors = On
html_errors = On

And restart apache:

并重新启动apache:

sudo /etc/init.d/apache2 restart

http://ubuntuforums.org/showpost.php?p=9592364&postcount=14

http://ubuntuforums.org/showpost.php?p=9592364&postcount=14

回答by Siddharth Tyagi

I checked my

我检查了我的

netstat -anp

netstat -anp

output and found out that there were number of open sockets (in XDebug port range) by master process on my remote machine [running xDebug].

输出并发现我的远程机器上的主进程有许多打开的套接字(在 XDebug 端口范围内)[运行 xDebug]。

Killing the 'master' process solved the problem for me.

杀死“主”进程为我解决了这个问题。

Seemed like a port overrun situation for me. Thought the information might be useful to some.

对我来说似乎是端口溢出的情况。认为这些信息可能对某些人有用。

回答by Darius.V

Check are you putting breakpoints to the right file. Find first file where script enters (front controller). On symfony there can be more than one for example.

检查您是否将断点放在正确的文件中。找到脚本进入的第一个文件(前端控制器)。例如,在 symfony 上可以有多个。

回答by max4ever

check port is not occupied, check netbeans is configured to listen to that port(i see you have 9001, 9000 is default usually)also when i debug with eclipse i have to "terminate and relaunch" the debug session every now and then since it stops working, never under stood why, i suspect some sort of expired debug session

检查端口未被占用,检查 netbeans 是否配置为侦听该端口(我看到您有 9001,通常默认为 9000)当我使用 Eclipse 进行调试时,我必须时不时地“终止并重新启动”调试会话,因为它停止工作,永远不明白为什么,我怀疑某种过期的调试会话