Maintenance

500 Internal Server Error in WordPress: How to Find the Cause and Fix It

Fix a 500 internal server error in WordPress: read the error log, turn on WP_DEBUG_LOG safely, reset .htaccess, find the faulty plugin, check PHP limits.

500 Internal Server Error in WordPress: How to Find the Cause and Fix It
On this page
  1. A 500 error or a critical error?
  2. Before you change anything: take a backup
  3. Find and read the server error log
  4. Turn on WP_DEBUG_LOG safely
  5. Corrupt or invalid .htaccess
  6. Plugin and theme fatal errors
  7. Memory, PHP version and server limits
  8. Preventing the next 500 error
  9. A safe fix order, and when to call your host
  10. Quick check: switch off plugins when wp-admin is down
  11. When to get help
  12. FAQs
Key takeaways
  • A 500 internal server error is a generic failure; the real cause is almost always written in the server error log or the WordPress debug log.
  • The usual culprits are a plugin or theme fatal error, a corrupt .htaccess file, memory limits or a PHP version the code does not support.
  • Take a backup, read the log, then change one thing at a time; do not reinstall WordPress or restore old backups blindly.

A 500 internal server error in WordPress means the server hit a problem it could not describe, usually a PHP fatal error from a plugin or theme, a broken .htaccess file, a memory limit or a PHP version mismatch. The fastest fix is to read the error log: your hosting panel's error log or WordPress's debug.log names the file and line that failed. From there, you rename the faulty plugin, reset .htaccess or raise the limit, one change at a time.

Below is the order to work in, with the safe way to turn on logging and what to tell your host if the cause is on their side.

The exact cause of a 500 is almost always in a log file; here is where the WordPress error log is and how to read it.

A 500 error or a critical error?

Since WordPress 5.2, many PHP fatal errors show "There has been a critical error on this website" instead of a bare 500 page, and WordPress may email the admin address a recovery mode link. The cause is the same family of problems; the critical error message is just friendlier. If you see that message or got that email, also read fixing the WordPress critical error, which covers recovery mode. If the screen is completely blank, see the white screen of death.

What you seeLikely layerWhere to start
"500 Internal Server Error" from Apache or LiteSpeed.htaccess or server configuration, or PHP fatal errorServer error log, .htaccess
"There has been a critical error on this website"PHP fatal error in WordPress codeRecovery mode email, debug.log
500 only in wp-adminAdmin-only plugin code or memorydebug.log, recently updated plugins
500 only on one page or actionCode that runs on that page, such as checkout or a formdebug.log at the time you load it
500 after changing PHP versionOld plugin or theme codeSwitch PHP back, then update code
500 together with 502 or 504Capacity or timeoutsSee the gateway timeout guide

For capacity problems, 502 and 504 gateway errors is the better guide. And if the message is "Error establishing a database connection", that is a separate issue covered in the database connection error fix.

Before you change anything: take a backup

Even a broken site can be backed up. Use your hosting panel's backup tool, or download wp-content and export the database through phpMyAdmin. If a fix goes wrong, you can return to this point. The WordPress backup and restore guide explains how.

Find and read the server error log

Most Indian shared hosting panels, including cPanel and hPanel, have an error log view, or an error_log file in the site's root or wp-admin folder. Open it and look at entries with the time the error happened. A useful line looks something like:

PHP Fatal error:  Uncaught Error: Call to undefined function some_function()
in /home/user/public_html/wp-content/plugins/example-plugin/includes/file.php:42

The path tells you which plugin or theme failed. "Allowed memory size exhausted" points at memory. Lines mentioning .htaccess, such as "Invalid command" or "RewriteRule", point at a bad rule. If there is no log access, ask your host to send the error log entries for the time of the error.

Turn on WP_DEBUG_LOG safely

If the server log is empty or unclear, WordPress can write its own log. Edit wp-config.php through the file manager or FTP and set these lines above the line that says to stop editing:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

Reload the failing page, then open wp-content/debug.log. WP_DEBUG_DISPLAY set to false keeps errors off the screen so visitors do not see file paths. When you are done, set WP_DEBUG back to false and delete debug.log, because it can grow large and should not be left publicly readable.

Corrupt or invalid .htaccess

On Apache and LiteSpeed servers, .htaccess holds rewrite rules for permalinks, plus rules added by caching, security and redirect plugins. A single bad line can cause a 500 on every page.

  1. In the file manager, rename .htaccess to .htaccess-old.
  2. Reload the site. If it works, the file was the problem.
  3. Log in, go to Settings > Permalinks and click Save without changes. WordPress writes a fresh default file.
  4. Re-add any custom rules from the old file one block at a time, testing after each.

Nginx servers do not use .htaccess, so on those hosts skip this step.

Plugin and theme fatal errors

Most 500 errors after an update or a new install come from a plugin or theme. If the log names one, rename that plugin's folder in wp-content/plugins, for example from example-plugin to example-plugin-off. WordPress deactivates it, and the site usually comes back.

If the log does not name one:

  • Rename the whole plugins folder to plugins-off to deactivate everything. If the site loads, rename it back and reactivate plugins one by one from the dashboard.
  • If plugins are not the cause, rename the active theme's folder; WordPress falls back to a default theme if one is installed.
  • Check custom code in functions.php or a snippets plugin, a common source of errors after a small edit.

Plugin conflict troubleshooting covers testing on staging so the live site is not affected. Once you find the culprit, update it, replace it or roll back to the previous version, and report the error to its developer.

Memory, PHP version and server limits

  • Memory: an "Allowed memory size exhausted" error means a script needed more memory than allowed. Raise WP_MEMORY_LIMIT in wp-config.php within your plan's limit, and look at what is using so much; memory limit errors explains both.
  • PHP version: old plugins and themes can fail on newer PHP, and new plugins may require a recent version. If the 500 started after a PHP change, switch back in the hosting panel, update the code, then try again. See how to update PHP safely.
  • File permissions: some servers return a 500 when files or folders are writable by everyone. Folders are normally 755 and files 644.
  • Server problems: a PHP service crash or misconfiguration is the host's job to fix.

Preventing the next 500 error

Most 500 errors are triggered by a change: an update, a new plugin, a code edit or a hosting change. A few habits make them rare, and quick to undo when they do happen:

  • Update with a backup first. Take a fresh backup before updating plugins, themes or WordPress core, so a bad update can be rolled back in minutes.
  • Test bigger updates on staging. Major plugin versions, WooCommerce updates and PHP changes are worth trying on a copy of the site before the live one.
  • Update one thing at a time when something matters, such as a payment or booking plugin, so you know exactly which change caused a problem.
  • Avoid editing functions.php in the dashboard editor. One missing bracket can take the site down with no way back in. Edit through the file manager or a snippets plugin that can disable a faulty snippet.
  • Remove plugins you no longer use, and avoid abandoned ones that have not been updated for a long time.
  • Watch uptime. An uptime monitor emails you when the site returns errors, so you hear about a 500 before customers do.

A safe fix order, and when to call your host

  1. Back up files and database.
  2. Read the server error log for the time of the error.
  3. Enable WP_DEBUG_LOG if the server log is unclear.
  4. Rename .htaccess and regenerate it.
  5. Rename the plugin named in the log, or all plugins, then the theme.
  6. Check memory, PHP version and permissions.
  7. Turn debugging off and remove debug.log.

Call your host if there are no log entries at all, if even a plain test file in the site root gives a 500, or if the log shows server-level messages you do not recognise. Give them the exact time, URL and any log lines.

Avoid reinstalling WordPress or restoring an old backup before finding the cause. A reinstall rarely fixes plugin errors, and an old backup can lose recent orders and enquiries.

Quick check: switch off plugins when wp-admin is down

When the dashboard itself returns a 500, WP-CLI can still work if you tell it to skip plugins and themes. Over SSH, from the WordPress root:

wp plugin list --status=active --skip-plugins --skip-themes
wp plugin deactivate plugin-folder-name --skip-plugins --skip-themes

Deactivate the plugin named in the error log first; if there is no log entry, deactivate the most recently updated plugin and reload the site after each one. To check a theme or custom file you edited, php -l wp-content/themes/your-theme/functions.php reports a syntax error and its line number without loading WordPress.

When to get help

Get help when the log makes no sense, when no log is being written, or when the site is down during business hours and takes orders. You can hire a WordPress developer to find and fix the cause. To have updates tested with a backup first, so the next 500 does not happen on the live site, see WordPress maintenance plans.

FAQs

How do I fix a 500 internal server error in WordPress?

Take a backup, read the error log, then fix what it names: rename the faulty plugin or theme folder, reset .htaccess, raise the memory limit or switch PHP back. Change one thing at a time.

Can a plugin update cause a 500 error?

Yes, it is one of the most common causes, especially when a plugin needs a newer PHP version or clashes with another plugin. Renaming its folder disables it so you can log in.

Will I lose my content because of a 500 error?

No. Your posts, pages and orders are in the database and are not affected by the error itself. Take care not to overwrite them with an old backup while fixing it.

Why is there nothing in my error log?

Logging may be off, or the error is happening before PHP runs, for example in .htaccess or server configuration. Enable WP_DEBUG_LOG and ask your host for the server-level log.

Is a 500 error bad for SEO?

Briefly, no. If Google keeps getting 500 errors over days, it crawls less and can drop affected pages, so fix it promptly.

Need help with your website?

I'm a freelance WordPress developer building fast, SEO-friendly websites since 2020. Tell me what you need and I'll reply with a plan and a fixed quote, usually within 24 hours.

Found this useful? Share it:
Contact

Let's build your next website

Available for freelance projects, agency white-label work and long-term maintenance. Feel free to pass this along to your team or company.

I reply within 24 hours, usually the same day. Your details are emailed to me, then WhatsApp opens so we can chat right away.

Chat now