> >> My suggestion for a fix would be to emulate what Apache always did: >> >> One MINIT/MSHUTDOWN in the main control process (I think it needed that >> to be able to implement php_admin_value and php_value), and then >> additionally also in each worker process. >> > > As I said above, it won't probably fully fix your problem but if you still > want to try to tackle it and move the MINIT, the way that I would do it is > to try to separate the whole sapi init logic and call it from the child > init as the first thing. If you want to experiment with using > php_admin_value before the module minit, then it might be worth to try put > fpm_php_init_child (or just the defines) to sapi startup callback before > calling php_module_startup so the main INIs are loads but it might be a bit > tricky to get worker pool config - it might need some extra globals maybe > for it. But not sure if that's gonna work (e.g. if the main INI files are > loaded at the sapi startup stage) and what will be impact on extensions. > I'd probably have to check it more and try it. Think it's also something > that could happen in master branch only as it's changing some fundamental > bits in FPM... > > After thinking about this a bit more I think we would still need some way to provide the current functionality of the MINIT if that's moved on child level. The problem with not having such step is that opcache shm would be then segmented between children - each child process would have its own shm so it means that it would likely break things like opcache_reset that would work only for a single child but wouldn't have any impact on other children. Also apcu would be segmented and basically anything that uses shm would be in some way impacted. The question is if maybe that single MINIT is actually what's optimal for most extension and that symmetry is just for some special cases which is actually my feeling. In such case it would be probably better to keep MINIT as it is and introduce new step for that symmetry with MSHUTDOWN.
By the way that shm sharing on master level is not ideal because this should really be done on the pool level. I have been thinking about something called pool manager (process under master that would manage pool processes in the same or similar way as master does right know) for some time. That would allow this kind of shm sharing except other things. Regards Jakub