Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

phpx.x-fpm services fail to reload #23

Open
Mazamazine opened this issue Apr 24, 2023 · 3 comments
Open

phpx.x-fpm services fail to reload #23

Mazamazine opened this issue Apr 24, 2023 · 3 comments

Comments

@Mazamazine
Copy link

If the services are not running, /usr/lib/alternc/php7-fpm will fail with, for instance:

Reloading phpx.x-fpm configuration (via systemctl): phpx.x-fpm.servicephpx.x-fpm.service is not active, cannot reload.
 failed!

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:

Reloading php8.2-fpm configuration (via systemctl): php8.2-fpm.servicephp8.2-fpm.service is not active, cannot reload.                                                          
 failed!
Starting php8.2-fpm (via systemctl): php8.2-fpm.service.
@camlafit
Copy link
Contributor

@Mazamazine
Copy link
Author

Mazamazine commented Apr 25, 2023

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.

@camlafit
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants