The short answer
Turn on debug logging, read the log, disable plugins and the theme by renaming their folders, then check memory, .htaccess, PHP version and disk space.
Make it tell you the error
In wp-config.php, above the line that says to stop editing, add:
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);Reload the page, then read wp-content/debug.log. Also check the server error log. The file and line name the plugin or theme at fault. Turn debug off again when you are done.
Disable plugins
cd wp-content
mv plugins plugins.off
mkdir pluginsIf the site returns, rename the folders back one at a time to find the guilty plugin. With WP-CLI: wp plugin deactivate --all.
Try a default theme
wp theme activate twentytwentyfourIf WP-CLI is not available, rename the active theme folder and WordPress falls back to another theme.
Memory
Add define('WP_MEMORY_LIMIT', '256M'); to wp-config.php. If the host's limit is lower, it still applies, so check the PHP memory limit too.
The .htaccess file
A broken rule gives a 500 error. Rename .htaccess, load the site, then in the admin go to Settings, Permalinks and save to create a clean file.
PHP version and files
- A recent PHP version change often breaks old plugins. Switch back to the previous version to test.
- File permissions should be 755 for folders and 644 for files.
- A full disk or a corrupted upload can also cause errors: check
df -h.
If it looks hacked
Unknown files, redirects or new admin users mean a hack, not a bug. See hacked WordPress cleanup steps.
Questions people ask
Is a white screen the same as a 500 error?
Both usually come from a PHP error. A white screen shows nothing because errors are hidden. A 500 is the server saying something went wrong.
Should I leave debug mode on?
No. Turn it off after you fix the problem, because logs can contain sensitive details.
I cannot log in to the admin. What now?
Rename the plugins folder using the file manager or SFTP, then log in and add them back one at a time.