使用`php-fpm`执行模式在.htaccess中启用display_errors?

时间:2018-11-09 13:22:01

标签: php apache .htaccess

当PHP以cgimod_php模式执行时,我们可以在php.ini中禁用错误​​报告,并使用目录中的.htaccess文件在每个目录中启用它我们想要的任何目录。

php_flag display_startup_errors 1
php_flag display_errors 1
php_flag html_errors 1
php_value error_reporting -1

在php脚本脚本本身中执行此操作是没有用的,因为它会中断php解析错误,这是很常见的错误。

在运行php-fpm执行模式时,我该怎么做?有可能吗?

1 个答案:

答案 0 :(得分:2)

使用fpm时,PHP会在每个目录中扫描ini文件

http://php.net/manual/en/configuration.file.per-user.php

默认值为.user.ini

您应该能够在其中放置相同的配置,但语法与php.ini相同:

display_errors = On
display_startup_errors = On
html_errors = 1
error_reporting = -1