A 500 Internal Server Error means the server ran into an unexpected condition and could not complete the request. It is a generic message: the useful information is always in the server's error log, not on the page itself.
Start with the error log
Whatever the cause, the log entry tells you which file and which line went wrong. Everything else is guesswork.
- In your control panel, the site's error log is available under the domain's logs section.
- Over SSH, look in
/var/log/apache2/or/var/log/nginx/, and in the PHP error log for the site.
Read the last entries at the time the error appeared. If nothing at all has been written, the request may not be reaching your application — which itself narrows down the cause.
Common causes, in rough order of likelihood
Errors in .htaccess
The most frequent cause. A directive that is misspelled or not supported by the web server breaks every request to that directory. Note that .htaccess is read only by Apache and LiteSpeed — under Nginx it is ignored entirely, so a site that relies on it will misbehave after a web server change.
To confirm: rename the file temporarily to .htaccess.bak and reload the page. If the error disappears, the file is the cause. Then restore it and comment out directives in blocks until you find the one responsible.
An error in the application's code
A fatal PHP error produces a 500. Common after updating a CMS, its theme or a plugin, and after switching PHP version.
To see the actual message rather than the generic page, enable error logging for the site and read the log — do not enable display_errors on a live site, as it shows file paths and other details to visitors.
Wrong file or directory permissions
Scripts that are writable by everyone, or files owned by the wrong user, are refused. This often happens after files have been restored from a backup or copied as root: see Restoring a backup in KeyHelp for the same trap in a different context.
As a rule, directories should be 755 and files 644. Scripts should never need 777.
An incompatible PHP version
Application code that used functions removed in a newer PHP release fails immediately. If the error appeared right after you changed the version, change it back — the previous versions remain available. See Choosing the PHP version and changing PHP settings in Plesk or Choosing the PHP version and changing PHP settings in ISPmanager.
A script exceeding its limits
A script stopped by max_execution_time, or one that runs out of memory under memory_limit, ends as a 500. Typical during imports and other long operations. Raising the limits for that site usually resolves it.
A wrong path in the configuration
A path to a script or an include that no longer exists — often after moving a site to another server, where the directory structure differs.
If you cannot find it
Note what changed just before the error appeared: an update, a new plugin, an edited configuration file, a restored backup. In almost every case a 500 that appeared "by itself" followed a change of some kind.
If your server is managed by us, or you cannot interpret the log, open a ticket from your client area with the domain name and the time the error appeared, and we will look at the logs from our side.