XDebug 已安装,但不显示在 phpinfo() 中,也不起作用


XDebug installed but doesn't show in phpinfo() and doesn't work

我正在尝试让我的 NetBeans php 调试器在 Ubuntu 中工作。当我尝试启动调试会话时,它会永远尝试建立连接,但最终它给了我一条错误消息,指出没有可用的 netbeans-xdebug 连接。我已经安装了php5-xdebug,但是当我尝试使用phpinfo()查看它时,它没有显示。我的php/apache2/php.ini有这些代码行:

zend_extension=/usr/lib/php5/20090626/xdebug.so
[debug]
; Remote settings
xdebug.remote_autostart=off
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey="netbeans-xdebug"
; General
xdebug.auto_trace=off
xdebug.collect_includes=on
xdebug.collect_params=off
xdebug.collect_return=off
xdebug.default_enable=on
xdebug.extended_info=1
xdebug.manual_url=http://www.php.net
xdebug.show_local_vars=0
xdebug.show_mem_delta=0
xdebug.max_nesting_level=100
;xdebug.idekey=
; Trace options
xdebug.trace_format=0
xdebug.trace_output_dir=/tmp
xdebug.trace_options=0
xdebug.trace_output_name=crc32
; Profiling
xdebug.profiler_append=0
xdebug.profiler_enable=0
xdebug.profiler_enable_trigger=0
xdebug.profiler_output_dir=/tmp
xdebug.profiler_output_name=crc32

如您所见,我试图自己解决它,但我就是无法让它工作。任何帮助将不胜感激...

首先找出你的php.ini在ubuntu中使用流动命令行被调用的位置:

php -i |grep "php.ini"

您可以测试 xdebug 它是否正在使用 php 文件中的以下代码:

<?php
function test(){
    echo "Called @ ".xdebug_call_file().
    ":".xdebug_call_line()." from".
    xdebug_call_function();
}
test();

?>

并像这样运行脚本:PHP -e myphpfile.php

你会得到类似的东西:调用@/var/www/testxdebug.php:8 from{main}root@magento b

祝你好运

我猜你编辑了错误的PHP.ini

我不知道你的机器是否是这种情况,至少在我的机器中,/etc/php5/文件夹中有四个目录:/apache2、/apache2fiter、/cli ;有时你需要编辑/apache2filter 文件夹下的 php.ini 文件来激活 Xdebug~ 希望它能用