I have 2 sites (1 main site and another one configured as sub-server) running with PHP 7.2 (I haven’t installed any additional PHP modules or versions, so it’s a clean install). Under PHP options, I’ve selected FPM as PHP script execution mode for both of them.
The issue I am facing is that whenever I reboot my VPS, I get 503 error (Service Unavailable) when trying to access each of the sites. They only go back online after I go to Server Configuration > PHP options and click “save”, without changing anything (it doesn’t matter if I do that on the main site or on the sub-server site).
This issue doesn’t seem to have anything to do with PHP-FPM, since the service “php-fpm.service” is always in the correct state (active - running).
Could someone tell me what are all the steps that run in the script when the user clicks “save” under PHP options? Then I could at least create a cronjob at boot time (so that I do not need do login to Virtualmin everytime I need to restart the VPS) while I try to troubleshoot what exactly is going on.
Here are the lines created on this other error log file after I try to access the website (following a VPS restart):
[Thu Dec 29 22:41:05.203171 2022] [proxy:error] [pid 561] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /var/php-fpm/16723367433869.sock (*) failed
[Thu Dec 29 22:41:05.203243 2022] [proxy_fcgi:error] [pid 561] [client [MY_IP_ADDRESS]:56042] AH01079: failed to make connection to backend: httpd-UDS
[Thu Dec 29 22:41:05.691220 2022] [proxy:error] [pid 560] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /var/php-fpm/16723367433869.sock (*) failed
[Thu Dec 29 22:41:05.691291 2022] [proxy_fcgi:error] [pid 560] [client [MY_IP_ADDRESS]:56043] AH01079: failed to make connection to backend: httpd-UDS, referer: https://[MY_WEBSITE].com/
I had tried that before opening this topic. Restarting the php-fpm does nothing, only saving php options (without changing anything) solves the problem. So there is something else on the saving php script that does the trick, but I don’t know what.
I must also say that the status of php-fpm just after VPS reboot shows “active (running)”.
If so, it might be a different version of PHP-FPM that you need to restart.
You also might want to change the connection mode from “socket” to “tcp port”. On a few of our older servers we found the “tcp port” method was a bit more stable.
System Settings > Server Templates > Default Settings > PHP Options
*** I’m not sure if this change will address existing domains, or only new ones. ***
The issue was simply this: both services related to FPM (php-fpm.service and rh-php72-php-fpm.service) were not enabled by default on systemd. So I have simply enabled them and now I can reboot the VPS without any problems.
So this seems something to be fixed on the PHP options script… Shouldn’t it enable PHP-FPM services as soon as the user saves the changes when choosing FPM as the default PHP script execution method?
Thank you once again for your support, which helped me find the solution!