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

Mar*_*kic 1 php ubuntu netbeans xdebug

我正在尝试让 Ne​​tBeans 的 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
Run Code Online (Sandbox Code Playgroud)

如您所见,我曾尝试自己解决它,但我无法让它发挥作用。任何帮助将不胜感激...

ope*_*org 6

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

php -i |grep "php.ini"
Run Code Online (Sandbox Code Playgroud)

您可以测试 xdebug 是否与 php 文件中的以下代码一起工作:

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

?>

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

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

祝你好运