php5-fpm的display_errors无法与Nginx一起使用 [英] display_errors for php5-fpm not working with nginx
问题描述
我正在用php5-fpm运行nginx,并希望启用display_errors
.
我正在运行虚拟主机,因此请协助您启用display_errors
,display_startup_errors
的方式.
I am running nginx with php5-fpm and want to enable the display_errors
.
I am running a virtual host, so please help in making a way to enable display_errors
, display_startup_errors
.
我尝试修改/etc/php5/fpm/php.ini
.
;display_errors
Default Value: On
Development Value: On
;Production Value: Off
;display_startup_errors
Default Value: On
Development Value: On
;Production Value: Off
;error_reporting
Default Value: E_ALL
Development Value: E_ALL
;Production Value: E_ALL & ~E_DEPRECATED
;html_errors
Default Value: On
Development Value: On
;Production value: Off
;log_errors
Default Value: On
Development Value: On
;Production Value: On
每个不同的虚拟主机是否都需要有多个ini
文件,vhost对于php配置有什么影响吗?
Is it require to have multiple ini
files for each different virtual host, does vhost makes any difference for php configuration ?
我也在尝试set_ini()
,但是没有显示任何效果.在php.ini
文件中进行更改后,我重新启动了nginx和php5-fpm.
I am also trying set_ini()
, but it is not showing any effect. And I restarted nginx and php5-fpm after making changes in php.ini
file.
推荐答案
php.ini对于php-fpm无效.
The php.ini does nothing for php-fpm.
如果使用的是php-fpm:,则必须在与Web应用程序关联的fpm池配置中提供配置更改.这些文件的位置取决于您的系统.可能的位置是:
If you are using php-fpm: You must provide the configuration change in the fpm pool config associated with your web application. Where these are located depends on your system. The probably locations are:
-
/etc/php-fpm.d/mydomain.conf
(如果事物已被整齐地设置) -
/etc/php-fpm.conf
(如果您仅将一个conf用于php-fpm)
/etc/php-fpm.d/mydomain.conf
(if things have been set up neatly)/etc/php-fpm.conf
(if you are only using one conf for php-fpm)
您的配置路径与我的不同,因此请四处看看以了解您的配置路径.如果/etc/php-fpm.d/
中存在合适的conf,请不要在/etc/php-fpm.conf
中进行更改.
Your config paths are different from mine, so poke around to see what you have in there. Don't make changes in /etc/php-fpm.conf
if a suitable conf exists in /etc/php-fpm.d/
.
如果您不使用php-fpm:使用正确的配置更新php.ini.
If you are not using php-fpm: Update php.ini with the correct configuration.
更正您的配置:在问题所示的配置中,您没有注释文档,而不是提供正确的设置.您最好撤消那些更改,因为PHP不会理解它们.
Correct your configuration: In the configuration shown in the question, you have uncommented documentation rather than provided the correct settings. You had better undo those changes, because PHP won't understand them.
php-fpm的正确行是:
; enable display of errors
php_flag[display_errors] = on
php_flag[display_startup_errors] = on
普通php的正确行是:
; enable display of errors
display_errors = On
display_startup_errors = On
建议:请勿在生产环境中使用这些选项.最好的祝福.
Advice: Do not use these options in a production environment. Best wishes.
这篇关于php5-fpm的display_errors无法与Nginx一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!