3

我正在使用 nginx 和 php-fpm。

我的 phpinfo 页面显示 php 正在从 /etc/php5/fpm/php.ini 加载 php.ini 文件,我尝试更新该文件然后运行

sudo service php-fpm reload

但是php仍然使用旧设置,phpinfo显示旧值就好像我没有修改任何东西一样。

我尝试重新启动 php-fpm 甚至重新启动我的计算机,但它仍然无法正常工作,它只是不会加载新的 php.ini 值......

4

1 回答 1

5

您可能需要检查您的 FPM 池配置。您还可以在那里设置 php.ini 设置,我认为这是使用 FPM 时更好的地方。

您会在 FPM 池配置的末尾找到类似的内容:

; Additional php.ini defines, specific to this pool of workers. These settings
; overwrite the values previously defined in the php.ini. The directives are the
; same as the PHP SAPI:
;   php_value/php_flag             - you can set classic ini defines which can
;                                    be overwritten from PHP call 'ini_set'.
;   php_admin_value/php_admin_flag - these directives won't be overwritten by
;                                     PHP call 'ini_set'
; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.

; Defining 'extension' will load the corresponding shared extension from
; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
; overwrite previously defined php.ini values, but will append the new value
; instead.

; Note: path INI options can be relative and will be expanded with the prefix
; (pool, global or /usr/local)

; Default Value: nothing is defined by default except the values in php.ini and
;                specified at startup with the -d argument

现在您可以添加随机配置更改,例如:

php_flag[display_errors] = on

php_admin_flag[log_errors] = on

php_admin_value[memory_limit] = 128M
php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i

当然,请务必在更改配置后重新启动 FPM 以使其生效。

于 2013-09-04T21:05:50.453 回答