Re: FPM preloading of PHP files
| From: | Dmitry Stogov | Date: | Fri, 20 Apr 2018 13:01:06 +0000 |
| Subject: | Re: FPM preloading of PHP files | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-102067@lists.php.net to get a copy of this message | ||
This makes sense.
________________________________
From: jakub.php@gmail.com <jakub.php@gmail.com> on behalf of Jakub Zelenka
<bukka@php.net>
Sent: Friday, April 20, 2018 1:04:01 PM
To: Dmitry Stogov
Cc: PHP internals list
Subject: Re: FPM preloading of PHP files
Hi Dmitry,
On Fri, Apr 20, 2018 at 8:54 AM, Dmitry Stogov <dmitry@zend.com<mailto:dmitry@zend.com>> wrote:
Hi Jakub,
I thought about pre-loading explicitly specified files (or directories) on PHP startup, before
forking worker processes.
As result all pre-loadd files should be available to all workers. Of course the should be kept in
immutable form.
This is actually the reason why I'm thinking about the pool manager process in this context.
The current FPM architecture would make this quite problematic. Currently the process that would
have to preload the file would be a master process because it's the one that forks worker
processes. The problem is that many (probably most) configurations have master running as a root and
a worker process uses setuid and setgid to set a different user and group after the fork. I think
that would be a source of many bug reports if the resources created during preloading could not be
accessed by the application (worker executed files) because the permission issue. Also it
wouldn't be probably a good idea to give a root access to the preloading as it could have some
security implications. That's why I think it would be better to do preloading in a pool manager
process that I described before (basically a process with the pool configured user and group that
would spawn workers).
Cheers
Jakub