Guide
How to fix a 500 Internal Server Error
A 500 Internal Server Error means something went wrong on the server while building the page, but it cannot say what. The cause is usually a bad .htaccess rule, a PHP error in a plugin or theme, an exhausted memory limit or broken file permissions. Open the error log first, because it nearly always names the exact file and line responsible.
Meaning
What a 500 error is telling you
The 500 status code is the web server saying it hit an unexpected condition and could not complete your request. Unlike a 404 or 403, it does not point at the visitor or a missing page. It points at the site itself. The server is running and responding, but the code or configuration behind the page has failed.
Because 500 is a catch-all, the page itself is no help. The real detail goes into the server error log, which records the underlying problem as a line of text. That is why the first move in every 500 investigation is to read that log instead of guessing.
The error might hit the whole site, one section, or only certain actions such as saving a form. A site-wide 500 that began right after a change is almost always caused by that change, so think about what you edited, installed or updated just before.
Diagnosis
The fast route from error to cause
- Note when it beganWhat changed just before?
- Read the error logFind the file and line named
- Match the messageSyntax, memory, rule or permission
- Undo or fix itRestore the file or change the setting
- RetestReload in a private window
Want a second pair of eyes?
Send us the page address and the time of the error through live chat, open 24/7, and we will help you read the log.
Log messages
What common error log lines mean
| Message in the log | Meaning | Typical fix |
|---|---|---|
| Syntax error, unexpected | A PHP file has a typing mistake | Fix or restore the file named |
| Allowed memory size exhausted | A script needed more memory than allowed | Raise the PHP memory limit or lighten the plugin |
| Invalid command in .htaccess | A rule is not valid on this server | Remove or correct the line |
| Premature end of script headers | A script crashed or has wrong permissions | Check permissions and the script itself |
| Call to undefined function | A required PHP extension or plugin is missing | Enable the extension or reinstall the plugin |
| Maximum execution time exceeded | A task ran too long | Optimise it or raise the time limit |
| Cannot connect to database | Wrong details or the database is down | Check the credentials in the configuration file |
Step by step
Fixing a 500 error, in order
Reload and wait a minute
A brief spike or a deployment in progress can cause a short-lived 500. If it clears itself, check the log anyway for the cause.
Turn on error logging
In your control panel, make sure the error log is available for the domain. On WordPress you can also set WP_DEBUG_LOG to true in wp-config.php so errors are saved to a file.
Rename .htaccess
Rename it to .htaccess-old. If the site returns, the old file had a bad rule. On WordPress, resave Permalinks to build a fresh one.
Check the PHP version
Many 500 errors appear after a PHP version change, because an old plugin or theme does not support the new one. Pick a compatible version in the control panel and test.
Disable plugins and the theme
Rename the plugins folder, then switch to a default theme. Bring things back one at a time to find the culprit.
Raise limits
If the log shows memory or time limits, increase them in the PHP settings, or reduce what the code is trying to do.
Restore from a backup
If you cannot find the cause, restore files from before the problem began, then reapply your changes carefully.
The usual suspect
Why .htaccess causes so many 500 errors
The .htaccess file holds instructions that the web server reads on every request: redirects, rewrite rules, security headers, PHP settings and more. A single mistake in it, such as a missing bracket, a command the server does not support or a loop, stops the server processing the request and produces a 500.
People often meet this after pasting a snippet from a forum, or after a plugin writes its own block. The cure is to remove the newest block and test. If you have a backup of the file from when the site worked, restore it. If you have not, comment out lines with a hash symbol in front, working from the bottom upwards, until the site loads.
Remember that PHP settings placed in .htaccess differ depending on how PHP runs on the server. If a php_value line triggers the error, set the same option in the PHP settings area of the control panel instead.
Where it comes from
Server side or site side
Likely a server or setting issue
- Appears on every page including static ones
- Began after a PHP version change
- Log shows .htaccess or permission errors
- Affects several sites in one account
- Disappears after reverting a setting
Likely a code or content issue
- Appears only on certain pages or actions
- Began after an update or plugin install
- Log names a plugin, theme or script file
- Admin area fails but static files load
- Disappears after deactivating one plugin
Limits
Memory and time limits explained
PHP scripts run inside limits that protect the server and other sites from runaway code. Two matter most. The memory limit caps how much memory one request may use. The execution time limit caps how long it may run. A heavy plugin, an image import or a large export can exceed either and fail.
If the log says allowed memory size exhausted, a modest increase often solves it. Raising a limit forever is not a cure though. If a plugin needs far more than usual, ask whether it is doing something wasteful, whether a lighter alternative exists, or whether caching can reduce the work. Our servers use LiteSpeed with Redis object caching available, and both can reduce the load a busy site puts on PHP.
On a shared platform, resource limits also keep your site safe from noisy neighbours, thanks to CloudLinux isolation. If your site genuinely outgrows its plan, the answer is a larger plan, not endless limit changes.
Checklist
Before you contact support
- Note the exact time of the error
- Note what you changed just before
- Copy the last lines of the error log
- Try a private window and another device
- Rename .htaccess and test
- Switch off plugins by renaming the folder
- Check the PHP version setting
- Confirm a recent backup exists
Prevention
How to avoid the next 500 error
Back up before every update
A restore point turns a crisis into a five-minute job.
Update one thing at a time
Then you know which update caused any trouble.
Test on a staging copy
Try major changes away from the live site first.
Keep PHP supported
Use a current version and keep plugins compatible with it.
Edit carefully
Keep a copy of any file before you change it, especially .htaccess and wp-config.php.
Watch the logs
A quick look at the error log now and then catches problems early.
Perspective
When to stop and ask for help
You do not need to solve everything alone. If an hour of checking has not found the cause, collect the facts and ask. The useful ones are the page address, the time, what you changed and the last lines of the error log. With those, we can usually point to the problem quickly.
If the cause turns out to be a hacked file, the log may show code you do not recognise. Do not keep editing the live site. Contact us straight away and read our WordPress security guide for the recovery steps.
FAQ
Common questions
Is a 500 error my fault or the host?
Either is possible. It comes from the site configuration or code far more often than from the server itself, so check the error log and your recent changes first.
Will a 500 error go away on its own?
A brief one caused by a spike can. If it persists, it will not fix itself and you need to find the cause.
Does a 500 error affect SEO?
A short outage rarely matters. A long one makes search engines crawl less and can cause pages to drop from results, so fix it quickly.
Where is the error log?
In your hosting control panel, in the logs or errors area for the domain. If you cannot find it, ask live chat.
Could my plan be too small?
Occasionally. If the log keeps showing resource limits and the site has grown, a larger plan helps. Optimising and caching come first.
Keep reading
Related pages
Hosting that helps when things break
UK servers, LiteSpeed and live chat open 24/7 on every plan.