PHP:使用php-fpm时,何时应用.user.ini中的设置?
我在RHEL8系统上将Apache与php-fpm结合使用。 php-fpm是从 remi repo 安装的。
I'm using Apache with php-fpm on a RHEL8 system. php-fpm was installed from remi repo in version 7.2.
我添加了一个文件 .user.ini
在可访问网络的文件夹中,以设置 memory_limit = 256M
( /etc/php.ini的默认值为128M)。似乎有效。但是我发现,如果更改该值,似乎并不会立即应用该值并非总是。我通过反复调用输出 phpinfo();
的页面来进行检查。有时值会更改,有时则不会。
I've added a file .user.ini
in a web accessible folder to set memory_limit=256M
(default of /etc/php.ini is 128M). It seems to work. But I detected that the value does 'not always' seems to be applied immediately if I change it. I checked that by repeatedly calling a page that outputs phpinfo();
. Sometimes the value is changed, sometimes not.
我想它是php-fpm及其进程池(如果我正确理解的话)。新流程将具有新价值。旧的珍惜旧的珍贵。如果页面被调用,您将永远不知道哪个进程真正响应。
I guess that it is php-fpm with its process pool (if I did understand that correctly). New processes will have the new value. Old values the old one. And if a page gets called, you never know which process actually responds.
我认为重新加载php-fmp( systemctl重新加载php-fpm.service
)将重置这些进程,并且每个进程都具有更新后的值。
I think reloading php-fmp (systemctl reload php-fpm.service
) resets those processes and each has the updated value.
有人可以解释它的工作原理吗?关于 .user.ini
和php-fpm的重要信息是什么?
Can anyone explain how it works exactly? What is important to know, about .user.ini
and php-fpm? Can it be that some request will use the old value forever?
在链接的文档页面中,请参见 user_ini.cache_ttl ,它们定义了TTL(时间
From the linked documentation page, see user_ini.cache_ttl which define the TTL (Time To Live) of .user.ini file.
- 大的值对于性能而言更好,因此对于生产而言
- 较小的值对开发很有用
默认值为300、5',可能看起来很长。
Default value is 300, 5' which can seems long.