PHP 7.0.2在出错时执行回溯(PHP 7.0.2 performs backtrace on error)

编程入门 行业动态 更新时间:2024-10-27 10:23:58
PHP 7.0.2在出错时执行回溯(PHP 7.0.2 performs backtrace on error)

我在OS X El Capitan上运行PHP版本7.0.2,每次执行包含一些错误代码的PHP脚本时,它都会报告错误,然后似乎自动执行回溯。 我不太确定这是否是PHP 7中的新功能,但我似乎无法在任何地方或其他遇到类似问题的人中找到它。

例如:

<?php echo $a; ?>

如果从CLI执行,将返回以下输出:

PHP Notice: Undefined variable: a in /Path/to/file.php on line 2 PHP Stack trace: PHP 1. {main}() /Path/to/file.php:0 Notice: Undefined variable: a in /Path/to/file.php on line 2 Call Stack: 0.0002 350944 1. {main}() /Path/to/file.php:0

任何可能导致问题的见解都是受欢迎的。 谢谢。

I'm running PHP version 7.0.2 on OS X El Capitan and every time I execute a PHP script that contains some erroneous code, it reports the error and then seems to perform a backtrace automatically. I'm not so sure if this is a new feature in PHP 7, however I cannot seem to find mention of it anywhere or anyone else who's facing a similar problem.

For Example:

<?php echo $a; ?>

Will return the following output if executed from CLI:

PHP Notice: Undefined variable: a in /Path/to/file.php on line 2 PHP Stack trace: PHP 1. {main}() /Path/to/file.php:0 Notice: Undefined variable: a in /Path/to/file.php on line 2 Call Stack: 0.0002 350944 1. {main}() /Path/to/file.php:0

Any insight on what might be causing the problem is welcome. Thanks.

最满意答案

我面临的问题不在于PHP 7.0.2本身,而是在某种程度上被称为XDebug的扩展。 用于高级错误报告的XDebug在我的另一个项目中引起了问题,并且通过禁用它,它似乎解决了我的问题。 要禁用XDebug,您需要做的就是修改php.ini文件并将值debug.remote_autostart,debug.default_enable和debug.remote_enable从'on'更改为'off'。

The problem I was facing was not with PHP 7.0.2 itself, but with an extension that had somehow become enabled called XDebug. XDebug which is intended for advanced error reporting was causing problems in another project of mine and by disabling it, it seemed to solve my problem. In order to disable XDebug all you need to do is modify your php.ini file and change the values debug.remote_autostart, debug.default_enable, and debug.remote_enable from 'on' to 'off'.

更多推荐

本文发布于:2023-07-18 19:21:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1164469.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:PHP   performs   error   backtrace

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!