Troubleshooting guide · http-status · Published 2026-08-14 · 3 min read
HTTP 500 internal server error
Why a server returns 500 Internal Server Error, the ordered fix sequence (logs, restart, isolation, permissions, .htaccess, resource limits), and prevention.
- ·Error logs
- ·.htaccess
- ·File perms
Symptoms
The site returns a page that says "500 Internal Server Error" or "500 Internal Server Error: The server encountered an internal error and was unable to complete your request." The browser may show it for one page or the whole site. The most useful detail is what is different at the moment it starts: a new plugin, a theme switch, a deployment, or new environment variables.
Common causes
- A PHP fatal error, permission error, or missing file in a language like PHP, Python, or Node.
- A syntax error introduced during an update or deployment.
- Incorrect file or folder permissions (for example a config file the process cannot read).
- A broken
.htaccessfile on Apache, or a misconfigured web server rule. - A corrupted cache, session, or temporary file that is regenerated on every request.
- The application cannot reach the database, a dependency, or an external service it needs at that moment.
How to fix
Do these in order. Stop as soon as one restores the site.
- Check the server logs first. On most hosts the error log sits under the control panel under "Error logs" or at
logs/next to the site. The real error message names the file and line. This single step resolves most cases. - Restart the process or service if the host lets you. A stuck process can produce a 500 until restarted.
- Create a clean test file to isolate the scope. On a PHP site, an empty
test.phpthat prints nothing proves the server itself works, and the failure belongs to the application or its config. Delete the file afterwards. - Turn on visible error reporting temporarily on a non-live copy. For PHP that is
error_reporting(E_ALL); ini_set('display_errors', '1');at the top of a bootstrap file. Never leave display on for production. - Check file permissions. Files should usually be 644 and directories 755. An owner mismatch between uploads and the web process is the classic hidden cause.
- Rename the
.htaccessfile if the site uses Apache. If the site recovers, you have found the problem and can re-add rules one at a time. - Check for resource limits. A memory limit that is too low, or a worker pool that is exhausted, produces intermittent 500s under load. Raise the limit on a dev copy first.
- Regress the most recent change. If the error started after an update, disable the new plugin or module, or roll back the deployment, and confirm the site recovers.
Prevention
- Keep a known-bad change isolated: deploy config and code separately so a bad variable cannot take the whole site down.
- Test updates on a staging copy before applying to production.
- Leave error display off in production but keep error logging on and readable.
- Put a monitoring ping on the home page and a cacheable offline page so the 500 never becomes the whole experience.