How to fix the 500 error in WordPress
The 500 error in WordPress usually shows up as a white screen, generic message, or HTTP ERROR 500 after updating a plugin, switching theme, or editing wp-config.php. The real cause is in the log or in WP_DEBUG; follow this flow to find it fast.
Before you start
- Access to cPanel and to the WordPress admin (
/wp-admin/) — if you can’t reach the admin, use File Manager or FTP. - Know what changed: plugin/theme update, manual file edit, migration, or PHP switch.
- Recent backup from Backup Wizard or WP Toolkit.
Step 0 — Enable WP_DEBUG
Without debug enabled, the site only shows “Internal Server Error”. Edit wp-config.php from File Manager and add before /* That's all, stop editing! */:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
Reload the site: the log writes to wp-content/debug.log. There you’ll see the exact plugin, file and line.
Important: turn
WP_DEBUGoff when you’re done — it exposes sensitive information if it stays on in production.
Common causes in WordPress
1. Plugin conflict
A new (or just-updated) plugin breaks the site.
If you can’t reach the admin, disable them via File Manager:
- Go to
wp-content/. - Rename the
pluginsfolder toplugins.off. - Reload the site. If it loads, the problem is a plugin.
- Rename back to
pluginsand enter the admin (all are now deactivated). - Activate one by one until the error reproduces.
2. Theme conflict
A theme with code incompatible with your PHP or with a key plugin.
If you can’t enter the admin, force the default theme via phpMyAdmin:
- Open the WordPress database.
- In the
wp_optionstable look fortemplateandstylesheet. - Change both to
twentytwentyfour(or whichever default theme exists inwp-content/themes/). - Reload the site.
3. Corrupt .htaccess (permalinks)
A cache plugin update or a hosting move leaves an .htaccess that mod_rewrite can’t parse.
- In File Manager go to the WordPress root.
- Rename
.htaccessto.htaccess.old. - Reload the site.
- If it loads, go to Settings → Permalinks and click Save Changes without touching anything — WordPress regenerates a clean
.htaccess.
4. Exhausted PHP memory
debug.log shows Allowed memory size of … bytes exhausted.
Edit wp-config.php and add:
define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );
If the server limit is lower, also raise it from Select PHP Version → Options → memory_limit.
5. Incompatible PHP version
WordPress 6.x no longer officially supports PHP 7.4.
- In cPanel open Select PHP Version and switch to PHP 8.2 or 8.3.
- If an old plugin breaks under PHP 8, look for an update or replacement; staying on 7.4 is no longer a forward-looking option.
6. Damaged core files
Interrupted migration, FTP in binary mode, or malware deleted key files.
- Download the current version from
https://wordpress.org/download/. - Upload via FTP everything except
wp-config.phpand thewp-content/folder. - Overwrite
wp-admin/andwp-includes/completely.
7. Database unreachable
debug.log shows Error establishing a database connection.
- Verify
DB_NAME,DB_USER,DB_PASSWORDandDB_HOSTinwp-config.php. - In MySQL Databases confirm the user has All Privileges.
- If the database hit its quota or got corrupted, support can repair it.
Quick diagnosis (recommended order)
- Enable
WP_DEBUGand checkwp-content/debug.log. - Rename
plugins/and test. - Rename
.htaccessand re-save permalinks. - Raise
WP_MEMORY_LIMIT. - Switch PHP to 8.2/8.3.
- If nothing changes, upload clean core.
- Last resort: restore a backup from before the failure.
Final verification
- The frontend returns 200 in incognito.
-
/wp-admin/loads and lets you sign in. -
wp-content/debug.logproduces no new errors. -
WP_DEBUGis turned off again. - Critical plugins are reactivated and working.
Common diagnostic mistakes
- Leaving
WP_DEBUGon in production: exposes paths and versions. - Reactivating all plugins at once: do it one by one or you won’t know which one was guilty.
- Editing
wp-config.phpwithout a backup: always download a copy first. - Ignoring caches: purge LiteSpeed Cache, WP Rocket or Cloudflare after every test.
- Trusting “it looks fine” without opening the log: if you didn’t read the log, you didn’t diagnose.
Recommended readings
Still need help?
If this guide didn’t solve your issue, our team can help you via ticket.