Problem arising in reading you is at its origins, in plain italian "a monte".. 
;)

- PHP 8 is enough retrocompatible with any version you mention, and should take 
in a
  certain amount of benefits in performance gain and bug fixing;
- PHP-FPM should be enough configurable and versatile to support huge amount of 
requests;
- multi webservers could be nice to have probably for some sorts of load 
balancing only,
  (having a reversed proxy is something often questionable);
- multi webservers are surely a huge angle hole in your "resource room".

I do not know, are you maybe building your machine for testing purpose?

-- Daniele Bonini

Jul 10, 2023 13:01:10 Mike Fischer <fischer+o...@lavielle.com>:

> Hi!
> 
> I’m trying to figure out the best way to maintain multiple php-fpm setups at 
> the same time and ran into a somewhat annoying issue.
> 
> I’m not sure how many other users might have a similar situation? If this 
> something too non-standard, let me know and I’ll shut up ;-)
> 
> 
> Background
> ==========
> 
> The server supports multiple versions of PHP for websites using php-fpm. 
> There are also multiple web servers running at the same time (on different 
> IP/port combinations obviously). Specifically OpenBSD httpd and Apache httpd 
> from ports.
> 
> OpenBSD httpd runs in its normal chroot(2) environment. Apache httpd does not 
> use chroot(2). This requires corresponding setups for php-fpm as well. Using 
> e.g. a non-chroot(2) php-fpm with OpenBSD httpd does not work.
> 
> Each php-fpm variant uses its own socket. So changing the PHP version for a 
> web server (or even for just certain paths on that server) is as easy as 
> pointing to the correct socket for the FastCGI mechanism of the web server.
> 
> 
> Setup
> =====
> 
> All available PHP Versions are supported and configured. I.e. 7.4, 8.0, 8.1 
> and 8.2 for OpenBSD 7.3.
> 
> I have adjusted /etc/php-7.4.ini, /etc/php-8.0.ini, etc. as required
> 
> I have created and modified /etc/php-fpm-7.4cr.conf, 
> /etc/php-fpm-7.4ncr.conf, /etc/php-fpm-8.0cr.conf, /etc/php-fpm-8.0ncr.conf, 
> etc. The default /etc/php-fpm.conf is not actively used.
> 
> I have copied the /etc/rc.d/phpXX_fpm files and modified them to:
> - use the appropriate /etc/php-fpm.conf (/etc/php-fpm-7.4cr.conf, 
> /etc/php-fpm-7.4ncr.conf, /etc/php-fpm-8.0cr.conf, /etc/php-fpm-8.0ncr.conf, 
> etc.)
> - use the appropriate /etc/php.ini (/etc/php-7.4.ini, /etc/php-8.0.ini, 
> /etc/php-8.1.ini and /etc/php-8.2.ini)
> - adjust the pexp to match the php-fpm.conf in addition to "php-fpm-7.4: 
> master process", e.g. "php-fpm-7.4: master process 
> .*/etc/php-fpm-7.4cr.conf.*", etc.
> 
> Thus I have:
> /etc/rc.d/php74cr_fpm
> /etc/rc.d/php74ncr_fpm
> /etc/rc.d/php80cr_fpm
> /etc/rc.d/php80ncr_fpm
> /etc/rc.d/php81cr_fpm
> /etc/rc.d/php81ncr_fpm
> /etc/rc.d/php82cr_fpm
> /etc/rc.d/php82ncr_fpm
> 
> And all of these have been enabled using `rcctl enable php74cr_fpm 
> php74ncr_fpm php80cr_fpm php80ncr_fpm php81cr_fpm php81ncr_fpm php82cr_fpm 
> php82ncr_fpm` and of course started using `rcctl start …`.
> 
> For example:
> # cat /etc/rc.d/php82cr_fpm
> #!/bin/ksh
> 
> daemon="/usr/local/sbin/php-fpm-8.2"
> daemon_flags="-c /etc/php-8.2-cr.ini -y /etc/php-fpm-82cr.conf"
> 
> . /etc/rc.d/rc.subr
> 
> pexp="php-fpm-8.2: master process .*/etc/php-fpm-82cr.conf.*"
> rc_reload=NO
> 
> rc_cmd $1
> #
> 
> 
> (Note: I know this could be further reduced to just one master process for 
> each version with a chroot(2) and a non-chroot(2) pool defined in the single 
> php-fpm.conf for each PHP version. But that is irrelevant to the issue at 
> hand.)
> 
> 
> Issue
> =====
> 
> `rcctl ls started` lists php74_fpm, php80_fpm, php81_fpm and php82_fpm as 
> started even though they are neither enabled nor started!
> 
> The reason this happens is the pexp which is too general. E.g. for php74_fpm 
> it is pexp="php-fpm-7.4: master process .*"
> 
> Modifying this to e.g. pexp="php-fpm-7.4: master process 
> .*/etc/php-fpm.conf.*" solves the problem.
> 
> BUT: /etc/rc.d/php74_fpm will be overwritten when the php-7.4 port ist 
> updated. (Same for the other versions of course.) So my change is lost and 
> has to be reapplied. If I forget about this then at a later time I’ll become 
> confused by the output of `rcctl ls started`.
> 
> 
> Questions
> =========
> 
> 1) Is there a better, update-proof way to solve this problem?
> 
> 2) Would it make sense to include the more specific pexp in the PHP ports? (I 
> don’t think doing so would hurt the default use case, but maybe I’m 
> overlooking something?)
> 
> 
> OpenBSD 7.3, amd64
> 
> 
> Thanks!
> Mike

Reply via email to