NetBeans + xdebug:PHP异常没有堆栈跟踪

时间:2011-08-07 17:11:08

标签: php netbeans stack-trace xdebug remote-debugging

我是一名C ++ / C#程序员,他有一些使用PHP构建网站的经验。我最近安装了NetBeans和xdebug,因为我不能再使用调试器了。单步执行代码就像魅力一样,但似乎无法让xdebug暂停异常并向我显示调用堆栈。

以下是一个例子:

<?php
    // File is not found. xdebug should stop and show the call stack.
    require 'nonexistant.php';
?>

我使用本地MAMP PRO 2.0.1服务器在Mac(Snow Leopard)上运行。我有NetBeans 7.0.1,配置为使用我的MAMP PHP解释器,使用xdebug 2.1.0运行。这是我当前的xdebug设置,位于我的“php.ini”文件中:

zend_extension="/Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=1

以下是NetBeans中我的设置​​的屏幕截图:

NetBeans PHP Options for xdebug

我已经验证正在加载“php.ini”中的设置,并且NetBeans已正确配置以进行调试,但我仍然无法获得异常或内部错误来生成堆栈跟踪。任何接受者? :)

1 个答案:

答案 0 :(得分:1)

display_errors是否已开启?

对于您的具体示例:

<?php
    // File is not found. xdebug should stop and show the call stack.
    require 'nonexistant.php';
?>

您正在创建致命错误,并且需要在php.ini中打开display_errors 如果您在运行时使用ini_set(),则不会显示致命错误。

要查看捕获的异常的堆栈跟踪,您需要打开:
xdebug.show_exception_trace

好吧,

相关问题