简体   繁体   English

重新加载 nginx 和 php5-fpm 不会更新对 php.ini 的更改

[英]Reloading nginx & php5-fpm does not update changes to php.ini

I've made changes to max_upload_size in /etc/php5/fpm/php.ini and restarted both nginx and php5-fpm services.我在/etc/php5/fpm/php.ini中对max_upload_size进行了更改,并重新启动了 nginx 和 php5-fpm 服务。 phpinfo() states that /etc/php5/fpm/php.ini is being loaded but after reloading/restartinb both services, max_upload_size remains unchanged. phpinfo()声明/etc/php5/fpm/php.ini正在加载,但在重新加载/重新启动两个服务之后, max_upload_size保持不变。

Question: A server reboot solved the problem.问题:服务器重启解决了这个问题。 Why is a reboot required?为什么需要重新启动? Did I miss out anything when restarting the services?重新启动服务时我错过了什么吗?

The issue is probably that you never actually restarted php-fpm.问题可能是您从未真正重新启动过 php-fpm。 I had issues with this as well, apparently theres a bunch of different ways to restart php-fpm, and some of them dont work for certain environments.我也有这个问题,显然有很多不同的方法可以重新启动 php-fpm,其中一些不适用于某些环境。

https://serverfault.com/questions/189940/how-do-you-restart-php-fpm/506951 https://serverfault.com/questions/189940/how-do-you-restart-php-fpm/506951

Try those and see if they reload it.试试这些,看看他们是否重新加载它。

I know there is already an answer to this but I also have had a similar problem to this one and Galen 's answer did not help with me.我知道已经有了答案,但我也遇到了与此类似的问题,而Galen的答案对我没有帮助。


My answer is to instead of editing /etc/php5/fpm/php.ini , edit your /etc/php5/fpm/php-fpm.conf file and add to the end something like this:我的答案是编辑/etc/php5/fpm/php-fpm.conf文件,而不是编辑/etc/php5/fpm/php.ini ,并在末尾添加如下内容:

php_admin_value[memory_limit] = 10M

Where memory_limit is the value you are wanting to edit on your php.ini and 10M ... I think you get the picture!其中memory_limit是您要在php.ini10M上编辑的值……我想您明白了!

CentOS 7、PHP 5.6、nginx 1.12 使用

systemctl reload php-fpm

If doing: sudo service php-fpm reload如果这样做: sudo service php-fpm reload

You get errors like: php-fpm: unrecognized service您会收到如下错误: php-fpm: unrecognized service

(Although you see it like this when doing ps aux | grep php ) (虽然你在执行ps aux | grep php时会看到这样的情况)

Use command: sudo service --status-all | grep -i fpm使用命令: sudo service --status-all | grep -i fpm sudo service --status-all | grep -i fpm to see the real names of services. sudo service --status-all | grep -i fpm查看服务的真实名称。

Then do: sudo service php7.3-fpm reload to reread php.ini然后执行: sudo service php7.3-fpm reload重新读取 php.ini

nginx is in use. nginx正在使用中。 whoever in rush editing php.ini like me this might be the correct paths to edit像我这样急于编辑php.ini的人,这可能是正确的编辑路径

/etc/php/7.4/fpm/php.ini
/etc/php/7.4/cli/php.ini

then to take effect然后生效

service php7.4-fpm restart
service nginx restart

also this one could help to see what process is running and where php.ini is这也可以帮助查看正在运行的进程以及 php.ini 的位置

ps aux | grep php
php -i | grep php.ini

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

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