Open Mazamazine opened 1 year ago
Hello
should be solved with https://github.com/AlternC/alternc-php-fpm/blob/issue-18/src/usr/lib/alternc/php7-fpm#L76
Is it enough ?
It doesn't work because the unit exists even if the service is dead. The script checks for /etc/php/$version/fpm/pool.d
so it will try anyway for any installed version:
root@staging-alternc:/usr/lib/alternc# service php5.6-fpm status | grep 'Active:'
Active: inactive (dead) since Tue 2023-04-25 15:09:58 EDT; 2min 39s ago
root@staging-alternc:/usr/lib/alternc# ls /etc/init.d/php*
/etc/init.d/php5.6-fpm /etc/init.d/php7.1-fpm /etc/init.d/php7.3-fpm /etc/init.d/php8.0-fpm /etc/init.d/php8.2-fpm
/etc/init.d/php7.0-fpm /etc/init.d/php7.2-fpm /etc/init.d/php7.4-fpm /etc/init.d/php8.1-fpm
root@staging-alternc:/usr/lib/alternc# ./php7-fpm
Alternc-nss: updating files in /var/lib/extrausers/
2023-04-25 15:10:41 Log of php7-fpm
Creating php 5.6 fpm pool for user test
Reloading php5.6-fpm configuration (via systemctl): php5.6-fpm.servicephp5.6-fpm.service is not active, cannot reload.
failed!
So here, in a case where php5.6-fpm was not running, adding a sub-domain on 5.6 fails (silently from the user side, since it's from the cron). And the page will show a 503.
Hello
Ok we must improve this behavior and do a check between sysV and systemd. I'll do a next try to manage this two use case. If service is disabled script should not start it . We initial suggestion this choice will be ignored , and start forced.
If the services are not running, /usr/lib/alternc/php7-fpm will fail with, for instance:
An easy way is to add an OR in the reload call to ensure the service is started if not running:
passthru("/etc/init.d/php".$service."-fpm reload || /etc/init.d/php".$service."-fpm start");
Which works properly: