【问题标题】:Xdebug stopped working, where do I look for errors?Xdebug 停止工作,我在哪里查找错误?
【发布时间】:2012-04-01 13:34:14
【问题描述】:

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

php -m | grep deb

还提供了两次 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

然而,当运行此代码时,应该检查 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);

另外,根据 XDebug 安装,我经历了两次步骤。我的配置有什么问题?谢谢。

【问题讨论】:

  • 即使在添加 xdebug.remote_log="/tmp/xdebug.log" 并重新启动 Apache2 并运行应用程序后,日志仍为空...

标签: php ubuntu response xdebug


【解决方案1】:

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

更新

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

;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"

【讨论】:

    【解决方案2】:

    在你的服务器上,试试这个命令:

    $ netstat -anp | grep CLOSE_WAIT

    任何 :9000 个条目都会给您带来 XDebug 麻烦;考虑kill -9 &lt;pid&gt;

    【讨论】:

    • 对于那些不完全熟悉 linux 的人,我使用这个命令在 ubuntu 上的 PID 是最后一列:3131/apache2 PID = 3131
    【解决方案3】:

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

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

    然后重启apache:

    sudo /etc/init.d/apache2 restart
    

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

    【讨论】:

      【解决方案4】:

      我检查了我的

      netstat -anp

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

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

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

      【讨论】:

        【解决方案5】:

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

        【讨论】:

          【解决方案6】:

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

          【讨论】:

            【解决方案7】:

            在我将 xdebug 更新到 3 版本后,我只是放置/设置 php.ini 配置

            error_reporting=E_ALL
            display_startup_errors=1
            display_errors=1
            

            然后命令php -v 显示所有警告和错误。 就我而言:

            Xdebug: [Config] The setting 'xdebug.remote_enable' has been renamed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-xdebug.remote_enable (See: https://xdebug.org/docs/errors#CFG-C-CHANGED)
            

            【讨论】:

              猜你喜欢
              • 1970-01-01
              • 2018-07-04
              • 1970-01-01
              • 1970-01-01
              • 2021-05-20
              • 1970-01-01
              • 2012-10-18
              • 1970-01-01
              • 1970-01-01
              相关资源
              最近更新 更多