php5-fpm 的 display_errors 不适用于 nginx [英] display_errors for php5-fpm not working with nginx

查看:21
本文介绍了php5-fpm 的 display_errors 不适用于 nginx的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 php5-fpm 运行 nginx,并且想要启用 display_errors.我正在运行虚拟主机,因此请帮助制定一种启用 display_errorsdisplay_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(如果你只为 php-fpm 使用一个 conf)
  • /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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆