Some errors show up so often that they’ve basically become a rite of passage — every WordPress dev has stared at a blank white screen at least once. This post rounds up the most common website and server errors, why they actually happen, and the fix that works (not just “clear your cache and pray”).
Table of Contents
WordPress Errors
1. 500 Internal Server Error
Why it happens: Usually a corrupted .htaccess file, a plugin/theme conflict, or a PHP memory limit that’s too low — ironically, this often shows up right after someone increases max_execution_time and the server’s PHP config doesn’t actually allow the new value.
Fix:
- Rename
.htaccessto.htaccess_oldand let WordPress regenerate it (Settings → Permalinks → Save). - Deactivate all plugins via FTP (rename the
pluginsfolder) and reactivate one by one. - Check
wp-config.phpfordefine('WP_MEMORY_LIMIT', '256M');and raise it if needed. - If you edited
max_execution_timein.htaccessorphp.ini, confirm your host actually allows overriding it — some hosts silently reject values above a hard cap.
2. White Screen of Death (WSOD)
Why it happens: A PHP fatal error that WordPress isn’t configured to display, usually from a plugin/theme code error or exhausted memory.
Fix:
- Turn on debug mode in
wp-config.php:
php
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);- Check
wp-content/debug.logfor the actual error and file/line number. - Disable plugins/switch to a default theme (e.g., Twenty Twenty-Four) to isolate the cause.
3. “Error Establishing a Database Connection”
Why it happens: Wrong DB credentials in wp-config.php, a corrupted database, or the DB server itself is down/overloaded.
Fix:
- Double-check
DB_NAME,DB_USER,DB_PASSWORD,DB_HOSTinwp-config.php. - Try connecting to the database directly via phpMyAdmin/CLI to confirm it’s actually reachable.
- If credentials are correct, the table might need repair: add
define('WP_ALLOW_REPAIR', true);towp-config.phpand visit/wp-admin/maint/repair.php.
4. 413 Request Entity Too Large (upload fails)
Why it happens: The web server (Nginx/Apache) or PHP’s upload limits are smaller than the file being uploaded.
Fix:
- In
php.ini: increaseupload_max_filesizeandpost_max_size. - For Nginx, add
client_max_body_size 64M;inside theserverblock. - For Apache, add to
.htaccess:
apache
php_value upload_max_filesize 64M
php_value post_max_size 64M5. Syntax Error After Editing functions.php
Why it happens: A missing semicolon, unmatched bracket, or stray character — and because it’s PHP, one typo takes the whole site down.
Fix:
- Access the file via FTP/File Manager (not the WP admin editor, since the site is likely down) and fix or remove the last change.
- Always edit
functions.phplocally or in a staging environment first, never directly in production.
6. Mixed Content Errors (site loads, but “not secure”)
Why it happens: Some resources (images, scripts, CSS) are still being loaded over http:// while the rest of the site is on https://.
Fix:
- Search the database for hardcoded
http://URLs and replace them withhttps://(a search-replace plugin or WP-CLI’swp search-replacecommand works well). - Make sure the
siteurlandhomevalues in Settings → General both usehttps://.
7. Too Many Redirects (ERR_TOO_MANY_REDIRECTS)
Why it happens: Conflicting redirect rules — often an SSL plugin fighting with server-level HTTPS redirection, or siteurl/home mismatched with the actual domain.
Fix:
- Temporarily disable any SSL/redirect plugins and see if the loop stops.
- Check
.htaccessfor duplicateRewriteRuleredirect blocks. - Confirm
siteurlandhomein the database match exactly (protocol included).
8. “Allowed Memory Size Exhausted”
Why it happens: A plugin or theme is using more memory than PHP is allowed to allocate.
Fix:
- Raise the limit in
wp-config.php:define('WP_MEMORY_LIMIT', '256M'); - If that doesn’t help, the real fix is finding which plugin is memory-hungry — deactivate in batches to isolate it, since raising the limit is a band-aid, not a cure.
General Server Errors
9. 502 Bad Gateway vs. 504 Gateway Timeout
Why they happen: A 502 means the upstream server (e.g., PHP-FPM) sent an invalid response to the proxy (Nginx). A 504 means the upstream server took too long to respond at all.
Fix:
- 502: Check if PHP-FPM or the application server crashed — restart it and check its error logs.
- 504: Look for a slow database query or external API call that’s timing out; increase the proxy timeout as a stopgap while you fix the slow process itself.
10. 403 Forbidden
Why it happens: File/folder permission issues, a misconfigured .htaccess, or a security plugin/firewall blocking the request.
Fix:
- Standard permissions: folders
755, files644. - Comment out
.htaccessrules one at a time to find the blocking rule. - Check if a firewall (e.g., a WAF or security plugin) is flagging the IP or request.
11. SSL Certificate Errors (NET::ERR_CERT_AUTHORITY_INVALID, etc.)
Why it happens: Expired certificate, incomplete certificate chain (missing intermediate cert), or the certificate doesn’t match the domain.
Fix:
- Renew the certificate if expired (or check if auto-renewal, e.g., Let’s Encrypt/Certbot, silently failed).
- Reinstall the full certificate chain, not just the leaf certificate.
- Verify with an SSL checker tool that the chain is complete.
12. CORS Policy Error (“blocked by CORS policy”)
Why it happens: The browser is blocking a cross-origin request because the server didn’t send the right Access-Control-Allow-Origin header.
Fix:
- Add the appropriate CORS headers on the server/API responding to the request — don’t try to “fix” it from the frontend, since it’s a server-side header issue.
- For Nginx:
add_header 'Access-Control-Allow-Origin' '*';(scope this down to specific origins in production, not*).
Database Errors
13. MySQL “Too Many Connections”
Why it happens: The app is opening more DB connections than MySQL’s max_connections allows — often from connections not being closed properly, or genuine traffic spikes.
Fix:
- Short-term: raise
max_connectionsinmy.cnf. - Real fix: check for connection leaks in the application code, and consider connection pooling.
14. Deadlock Found When Trying to Get Lock
Why it happens: Two transactions are waiting on locks the other one holds — a classic concurrency issue.
Fix:
- Add retry logic in the application for deadlock errors specifically.
- Review transactions to keep them short and always access tables in the same order to avoid circular waits.
Git / Deployment
15. “fatal: refusing to merge unrelated histories”
Why it happens: You’re trying to merge two branches (or a local repo with a remote) that don’t share a common commit history — common when initializing a new repo that already has a remote with existing commits.
Fix:
bash
git pull origin main --allow-unrelated-historiesThen resolve any conflicts that come up like a normal merge.
The Common Thread
Almost every error on this list has the same three-step fix pattern: isolate (turn off/disable things until the problem disappears), read the actual log (not just the error message shown to the user), and fix the root cause instead of just raising a limit or restarting the server. Bookmark the log file locations for your stack — debug.log for WordPress, server error logs for Nginx/Apache — they’ll save you more time than any Stack Overflow thread.










