Articles in this section

Site does not work on PHP-FPM on Plesk: 503 service unavailable

Plesk for Linux kb: technical ABT: Group A

Applicable to:

  • Plesk for Linux

Symptoms

  • Sites that use the same PHP-FPM version (for example, 7.2 are not working):

    CONFIG_TEXT: 503 service unavailable

  • The following error appears in the domain's error log /var/www/vhosts/system/example.com/logs/error_log:

    CONFIG_TEXT: [proxy_fcgi:error] [pid 15605:tid 140353550149376] [client 203.0.113.2:45388] AH01079: failed to make connection to backend: httpd-UDS
    [proxy:error] [pid 15605:tid 140353373902592] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /var/www/vhosts/system/example.com/php-fpm.sock (*) failed

  • Socket /var/www/vhosts/system/example.com/php-fpm.sock does not exist and switching PHP handler to another one at Plesk > Domains > example.com > PHP Settings recreates it, but switching PHP handler back removes it again

  • Running the plesk repair web -n command provides output that is similar to the following:

    CONFIG_TEXT: Checking for obsolete PHP-FPM configuration files
    Domain example.com ............................................. [ERROR]
    - Domain example.com with PHP handler plesk-php82-fpm has
    obsolete PHP-FPM configuration file
    /opt/plesk/php/8.1/etc/php-fpm.d/example.com

Cause

The php-fpm.sock files for several domains are missing, because the PHP-related configuration files for the affected domains and PHP versions have either become corrupted or have gone missing entirely.

Resolution

  1. Log into the server via SSH

  2. Restart all PHP-FPM services that are assigned to domains by executing the following command:

    # systemctl restart plesk-php*

  3. Recreate the missing or corrupted configuration files and PHP sockets for all domains by executing the following command:

    # plesk repair web -y

If the 503 issues persist for some sites that use a specific PHP version, files that are corrupted remain, due to which you should do the following in order to recreate all of them from scratch:

1. Create a list of sites that use the specific PHP version by using the following example:

# plesk db -sNe "select name from hosting h,domains dom where dom.id = h.dom_id and php = 'true' AND php_handler_id LIKE 'plesk-php82-fpm'" domains.txt

2. Make sure a similar PHP version to the one the domains are using in the example is enabled ( plesk-php82-fastcgi for the purposes of this example) on the server

3. Switch all domains from the domains.txt file to that similar PHP version by executing the following command:

# cat domains.txt | while read i; do echo "[+] Updating domain: $i"; plesk bin domain -u $i -php_handler_id plesk-php83-fastcgi; done

4. Run the following command:

# plesk repair web -php-fpm-configuration

5. Switch all domains back to the previously used PHP version by using the following command:

# cat domains.txt | while read i; do echo "[+] Updating domain: $i"; plesk bin domain -u $i -php_handler_id plesk-php83-fpm; done

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.