How to Fix a 500 Internal Server Error — Diagnostic Guide
A 500 error means the server cannot process your request but will not tell you why. The most common causes are a corrupted .htaccess file, exhausted PHP memory, or a faulty plugin. Check your error log first.
A 500 error means the server cannot process your request but will not tell you why. The most common causes are a corrupted .htaccess file, exhausted PHP memory, or a faulty plugin. Check your error log first. If you do not have access to logs, rename .htaccess to .htaccess_old and refresh the page — this fixes 30-40% of 500 errors immediately.
What causes 500 errors
A 500 internal server error is the server's way of saying something went wrong without specifying what. Here is a decision tree for the most common causes:
| Cause | How often | Typical trigger | Quick check |
|---|---|---|---|
| Corrupted .htaccess | Very common (~35%) | Plugin update or manual edit with syntax errors | Rename .htaccess and reload |
| PHP memory limit exceeded | Common (~25%) | Plugin or theme consuming too much memory | Check error log for allowed memory size |
| Plugin or theme conflict | Common (~20%) | Update or activation of incompatible code | Disable all plugins via FTP |
| File permission errors | Less common (~10%) | File permissions set too restrictively | Check files are 644, folders 755 |
| Server configuration issue | Rare (~10%) | PHP version change, exhausted server resources | Check with hosting support |
Start from the top of this list and work down. The most common fixes are the quickest to try and will resolve the majority of 500 errors.
Diagnostic steps
Follow these steps in order when you encounter a 500 internal server error:
- 1. Check the error log. In cPanel, go to Error Log under Metrics. The log entry usually contains the exact file and line number causing the error. This is the single most useful diagnostic step.
- 2. Check .htaccess. Rename the .htaccess file in your site root to .htaccess_old using cPanel File Manager or FTP. If the site loads, the .htaccess file was corrupted. Generate a fresh one from WordPress Settings → Permalinks → Save.
- 3. Increase PHP memory limit. Add
define('WP_MEMORY_LIMIT', '256M');to your wp-config.php file. If this fixes the error, one of your plugins or themes was exhausting the default PHP memory. - 4. Disable plugins. Via FTP, rename the /wp-content/plugins/ folder to /plugins_old/. If the site loads, a plugin is the cause. Rename back to plugins/ and re-enable plugins one by one, testing the site after each.
- 5. Switch to a default theme. Rename your theme folder to force WordPress to fall back to a default theme. If this fixes the error, your theme has a conflict.
- 6. Check file permissions. Files should be 644, directories should be 755, and wp-config.php should be 600 or 640. Wrong permissions on critical files cause 500 errors.
Fixes by cause
Once you have identified the cause, here are the specific fixes:
- Corrupted .htaccess. Delete the corrupted file (you renamed it to .htaccess_old in step 2). Go to WordPress admin → Settings → Permalinks → click Save Changes. WordPress generates a clean .htaccess file.
- PHP memory exhaustion. Edit wp-config.php and add or increase
define('WP_MEMORY_LIMIT', '256M');. Place it before the line that says/* That's all, stop editing! */. If the error persists, ask your host to increase the PHP memory limit at the server level. - Plugin conflict. After finding the offending plugin (step 4), delete it and reinstall a fresh copy. If the plugin is incompatible with your PHP version, look for an alternative.
- Theme conflict. Delete the current theme and reinstall it from a fresh download. If the theme is incompatible, contact the developer or switch to a different theme.
- File permission issues. Use cPanel File Manager to set folders to 755 and files to 644. For wp-config.php, set 600. Be especially careful with wp-admin and wp-includes directories.
Prevention
Once you have fixed the immediate 500 error, take these steps to prevent future occurrences:
- Take regular backups. Daily automated backups mean you can restore your site in minutes if something breaks. See how to back up your website.
- Stage updates before applying them. Use a staging environment to test plugin, theme and WordPress updates before deploying to production.
- Monitor PHP error logs regularly. Check your cPanel Error Log once a week. Early warnings from warning-level messages can prevent errors from escalating.
- Keep PHP up to date. Outdated PHP versions cause compatibility issues with modern plugins and themes. Use PHP 8.1 or higher.
- Choose reliable plugins. Well-maintained plugins with regular updates are less likely to introduce conflicts. Remove plugins you no longer use.
If you are dealing with a hacked or compromised site that causes 500 errors, read our guide on website hacked — what to do.
Frequently asked questions
A corrupted .htaccess file is the single most common cause. Renaming .htaccess to .htaccess_old and refreshing the page fixes about 30-40% of 500 errors. If the site loads, generate a fresh .htaccess from WordPress.
In cPanel, open Error Log under Metrics. On many hosts you can also access /home/username/logs/ or check the site's error_log file in the root directory through cPanel's File Manager.
Yes. Plugins are the second most common cause. A plugin update that introduces incompatible code or exhausts PHP memory will trigger a 500 error. Disable all plugins via FTP, then enable them one by one to find the culprit.
Sometimes. A temporary server overload or a script timeout can cause a transient 500 error that resolves on refresh. If the error persists for more than 20-30 seconds across multiple refreshes, there is a permanent cause that needs fixing.
A 500 error means the server itself failed to process the request. A 502 bad gateway error means the server received an invalid response from an upstream server, such as a PHP-FPM process or a proxy.