1. The Immediate Diagnostic: Enable WP_DEBUG
Since a 500 error hides the actual PHP failure, you must force WordPress to reveal it.
- The Action: Edit your
wp-config.phpfile and find the linedefine( 'WP_DEBUG', false );. - The Fix: Change it to:PHP
define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', false ); - Result: This creates a
debug.logfile inside the/wp-content/folder. Check this file immediately; it will tell you exactly which file and which line of code triggered the fatal error.
2. Check the .htaccess File for Corruption
A common cause of 500 errors is a syntax error in your server configuration file, often caused by a redirection or security plugin.
- The Action: Connect via FTP or File Manager and rename your
.htaccessfile to.htaccess_old. - The Fix: Try loading your site. If it works, the issue was in that file. Go to Settings > Permalinks in your dashboard and click “Save Changes” to generate a fresh, clean
.htaccessfile.
3. Increase the PHP Memory Limit
If the error occurs only when you try to perform a specific task (like uploading a large image or accessing the dashboard), you are likely hitting the memory ceiling.
- The Action: Add the following line to your
wp-config.phpfile, just before the “That’s all, stop editing” message:define( 'WP_MEMORY_LIMIT', '256M' ); - Server Level: You may also need to increase the
memory_limitin yourphp.inifile on the VPS.
4. Deactivate All Plugins (The “Binary Search” Method)
If the logs didn’t point to a specific file, a plugin conflict is the most likely culprit.
- The Action: Rename the
/wp-content/plugins/folder to/plugins_old/. - The Fix: If the site loads, rename the folder back to
pluginsand reactivate them one by one until the site breaks again. This identifies the specific “poisoned” plugin.
5. Re-upload Core Files
Sometimes, a failed update or a server glitch can corrupt the core WordPress files themselves.
- The Action: Download a fresh copy of WordPress from WordPress.org.
- The Fix: Upload the
/wp-admin/and/wp-includes/folders to your server, overwriting the old ones. Do not touch thewp-contentfolder orwp-config.php.
6. Check Server Error Logs
If none of the above works, the issue is likely at the server level (NGINX/Apache), not the application level.
- The Action: Check your NGINX or Apache error logs (usually located in
/var/log/nginx/error.logor/var/log/apache2/error.log). - What to Look For: Look for “mod_rewrite” errors or “Permission denied” messages. If you see “Permission denied,” reset your ownership with:
sudo chown -R www-data:www-data /var/www/html