简体   繁体   English

您可以从命令行调用 PHP 并向终端显示错误,但不写入 error_log 吗?

[英]Can you call PHP from the command line and display errors to terminal, but without writing to error_log?

The folowing can be used to show errors on the terminal screen when you use PHP from the command line.当您从命令行使用 PHP 时,以下可用于在终端屏幕上显示错误。

php -d display_errors=on filename.php

However, when I do this, it also creates or appends to a file error_log in that same folder.但是,当我这样做时,它还会在同一文件夹中创建或附加到文件 error_log。

Is there any way to turn the displaying of errors on, but disable writing to an error_log file?有什么方法可以打开错误显示,但禁止写入 error_log 文件?

Try to add error_reporting=E_ALL.尝试添加error_reporting=E_ALL。 I think this one should show you errors inside of cli instead of log file.我认为这个应该在 cli 而不是日志文件中向您显示错误。

php -d error_reporting=E_ALL filename.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM