Site Not Opening: Errors 500, 502, 503, 504 (cPanel)

First look at the error code — it is shown on the page or in the browser tab. The code tells you where to look for the cause.

ErrorWhat it means
500 Internal Server Error, blank pagean error in the site's PHP code or in the .htaccess file
502 Bad Gatewaya Node.js or Python application has stopped or did not start
503 Service Unavailablethe site temporarily cannot handle the requests
504 Gateway Time-outa script is taking too long
"Error establishing a database connection"the site cannot connect to its database

The key tool: the error log

The error log almost always shows the cause of a 500 error. Open "Errors" in the "Metrics" group — it shows the latest web server errors. PHP errors are written to logs/php.error.log in the account home folder; on older accounts, to error_log files in the site folders. Details: site error log in cPanel.

Web server error log in cPanel
Web server error log in cPanel

500 and a blank page

  • PHP Fatal error in the log — an error in the code: the line shows the file and line number. If the error appeared after a WordPress plugin update, rename the plugin folder in wp-content/plugins — the site will open without it.
  • An error in .htaccess — rename the file to .htaccess.old and check the site. If it works, look for the wrong line in the file.
  • The site needs another PHP version — change it: PHP version in cPanel.
  • Allowed memory size exhausted — the site does not have enough PHP memory: raise memory_limit in the PHP settings.

502 Bad Gateway

A regular PHP site rarely shows 502. If the site runs on Node.js or Python, the application has stopped or did not start. Open the application settings (Node.js or Python), check the application log and restart it.

503 Service Unavailable

The site temporarily cannot keep up with the requests: many simultaneous visitors or search bots, heavy plugins, slow database queries. The error usually goes away within a few minutes. If it lasts longer, contact support from your client area and include the site and the time of the error.

504 Gateway Time-out

A script did not respond in time: a long import, a backup made by a plugin, a heavy report. Split the operation into parts or run it on a schedule — cron jobs. For a single script you can raise max_execution_time in the PHP settings.

Database connection error

The site cannot log in to the database with the details from its settings file: the database name, user or password is wrong. Step-by-step check: database connection error in cPanel.

If the log is empty and the error does not go away, contact support from your client area: include the page address and the time the error appeared.

Questions and answers
In the error log: "Errors" in the "Metrics" group and the logs/php.error.log file in the account home folder.
Rename that plugin's folder in wp-content/plugins with File Manager — WordPress will deactivate the plugin and the site will open.
Split the long operation into parts or run it through cron. For a single script you can raise max_execution_time in the PHP settings.