503 Service Unavailable due to wrong PHP configuration

Usually, a 503 Service Unavailable message is caused by the limited server’s capacity to serve requests. Anyway, there is a case when this error is caused by a misconfiguration in the site’s .htaccess file.

503 service unavailable
503 Error Service Unavailable

You can use the cat command to check the cPanel PHP code from the .htaccess file:

# cat .htaccess
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php72” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php72___lsphp .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

Now check if the PHP version from the .htaccess file is really installed on the server:

root@web [/]# /usr/local/cpanel/bin/rebuild_phpconf --current
DEFAULT PHP: ea-php73
ea-php70 SAPI: lsapi
ea-php73 SAPI: lsapi
ea-php74 SAPI: lsapi

As you can see PHP 7.2 is not installed on the server. Obviously, you have two options. The first one is to switch the site to an available PHP version. The other one is to install another PHP version via cPanel EasyApache.

Related articles:
Add support for a new PHP version in EasyApache 4
How to change the PHP version of your domain in cPanel

Leave a Reply