Home » Website Errors » 500 Internal Server Error: Read the Log, Find the Line, Fix the Cause
500 Internal Server Error: Read the Log, Find the Line, Fix the Cause
"Internal Server Error" is the server's way of saying something went wrong and it is not going to tell the visitor what. The page you get is deliberately vague. The details are sitting in a log file, and finding that log is 90 percent of the fix.
Step 1: note exactly when and where it happens
Before digging, write down:
- Which URL fails (one page, a group of pages, or everything).
- What triggers it (simply loading the page, submitting a form, saving in the admin).
- What changed recently: an update, a new plugin, an edited config file, a hosting change.
A 500 that appears right after a change almost always comes from that change. Undo it first and see if the error goes.
Step 2: find the error log
Where the log lives depends on the setup:
| Setup | Where to look |
|---|---|
| cPanel hosting | "Errors" or "Error Log" in the control panel, or error_log files inside site folders |
| Plesk | Websites & Domains → Logs |
| Apache on a VPS | /var/log/apache2/error.log or /var/log/httpd/error_log |
| nginx + PHP-FPM | /var/log/nginx/error.log and the PHP-FPM log |
| WordPress | wp-content/debug.log after enabling debug logging |
| Node / Python apps | Your process manager's log (pm2 logs, journalctl -u app) |
Watch it live while you reload the failing page:
sudo tail -f /var/log/apache2/error.log
The newest line at the moment of the error is the one that matters.
Step 3: match the message to a cause
| Log says | What it means |
|---|---|
PHP Parse error: syntax error, unexpected ... |
A typo in a PHP file. See the PHP syntax error guide. |
Allowed memory size of ... bytes exhausted |
PHP ran out of memory. Raise memory_limit or find the heavy plugin. |
Invalid command '...', perhaps misspelled |
A bad line in .htaccess, often a directive for a module the host does not have. |
Maximum execution time of 30 seconds exceeded |
A slow script hit the time limit. |
Permission denied |
The server cannot read or execute a file it needs. |
End of script output before headers |
A CGI script crashed before sending anything, often wrong permissions or line endings. |
Step 4: the usual suspects, in order
If you cannot reach the log, test the common causes one at a time:
.htaccess: rename it and reload. If the site comes back (even with broken links), the file has a bad line.- Plugins or extensions: rename the plugins folder to disable them all at once. If that fixes it, rename it back and disable them one by one.
- Theme: switch to a default theme.
- PHP version: a recent PHP upgrade can break old code. Most control panels let you switch versions per site.
- Memory: raise the PHP memory limit to 256M as a test.
Step 5: turn on detailed errors briefly
On a staging copy, or for a few minutes on a quiet site, showing errors on screen can speed things up. For PHP, add to the top of index.php:
ini_set('display_errors', 1);
error_reporting(E_ALL);
Remove it as soon as you have the message. Never leave error display on in production.
Common mistakes
- Reinstalling the whole site before reading the log.
- Editing a file over FTP, getting the 500, then editing more things without undoing the first change.
- Leaving
display_errorson after the fix, which exposes file paths to anyone. - Treating a 500 as a hosting outage when only one page fails.
Frequently Asked Questions
Why does a 500 error show no details?
Showing internal errors to visitors would leak file paths and code details to attackers, so production servers hide them on purpose. The full message is written to the server or application error log instead.
Is a 500 error the host's fault?
Usually not. Most 500s come from the site's own code, plugins or configuration files. Hosts are responsible when the server itself is overloaded or misconfigured, which their status page or support can confirm.
Can a 500 error fix itself?
If it was caused by a short resource spike, yes. If it repeats on the same page, a real fault is waiting in the log and will not go away on its own.
Found a mistake or still stuck? Contact us. See how we write and check these guides in our editorial policy, or read about DocumentGuy.