问题
I'm using Apache with php-fpm on a RHEL8 system. php-fpm was installed from remi repo in version 7.2.
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.
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.
I think reloading php-fmp (systemctl reload php-fpm.service
) resets those processes and each has the updated value.
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?
回答1:
From the linked documentation page, see user_ini.cache_ttl which define the TTL (Time To Live) of .user.ini file.
- Large value is better for performance, so for production
- Small value can be useful for development
Default value is 300, 5' which can seems long.
来源:https://stackoverflow.com/questions/58841305/php-when-are-settings-in-user-ini-get-applied-when-using-php-fpm