Last week, we posted about HTTP 500 errors and some of the common causes we see. We got a few comments and DMs asking about how to diagnose and fix internal server errors, so here’s a follow-up.
Quick recap: HTTP 500 errors happen when your server encounters an unexpected condition that prevents it from fulfilling a request. These can be caused by various issues, from misconfigurations and bad plugins to server overload. (Breakdown of HTTP 500 errors here: Common causes of HTTP 500 errors: https://www.reddit.com/r/Hosting/comments/1etqfs4/why_you_are_getting_http_500_errors/)
There are a few initial steps to take to narrow the window of why you’re getting the 500 error from a diagnostic standpoint. Start with these:
Check server logs: Look in the “Logs” section of your cPanel or /var/log/ folder of your VPS and look for entries around the time the error occurred. You can try searching for terms like “error” “crtical” or “alert.”
Review recent changes: Recent updates to your website, new plugins, or changes to your server configuration are all potential causes. Check your CMS/version control system, plugins/extensions/themes, db, file systems, etc.
Test on different devices/browsers: This helps determine if the issue is specific to certain conditions (cache/cookies, device compatibility, browser version, network, etc.) or if it's a universal problem.
If you aren’t sure how to perform the first two steps, your host should be able to help you identify the issue. As for actually resolving an internal server error, there are a few things you can try before reaching out to your hosting provider (if reloading the page or clearing your browser cache doesn’t work):
Check for plugin/theme conflicts:
When using a CMS like WordPress, plugins and themes can sometimes conflict with each other or with core functionality. Deactivate all plugins and switch to a default theme to isolate the issue. If this resolves the error, systematically reactivate each plugin and theme, testing the site after each activation. This should help you identify which specific component is causing the conflict. Remember to back up your site before making these changes, and consider using a staging environment for testing if available.
Review your .htaccess file:
The .htaccess file controls server configuration for your website. A corrupt or misconfigured .htaccess can trigger 500 errors. To test, rename the current file (e.g., to .htaccess_old) using FTP or your hosting control panel. If this resolves the issue, create a new .htaccess with basic settings. For WordPress, you can generate a default .htaccess by going to Settings > Permalinks and clicking "Save Changes". Gradually add custom rules back, testing after each addition to identify problematic configurations.
Increase PHP memory limit:
PHP scripts require memory to execute. If a script exhausts the allocated memory, it can trigger a 500 error. To increase the limit, you may need to edit the php.ini file (If you don't have direct access, contact your hosting provider). You can also try adding this line to your wp-config.php file for WordPress sites: define('WP_MEMORY_LIMIT', '256M');. Always monitor your site's performance after increasing memory limits, as it may indicate underlying optimization issues.
Check file permissions:
File permissions control who can read, write, and execute files on your server. Incorrect permissions can prevent the server from accessing necessary files, causing 500 errors. Use FTP or your hosting control panel to check and modify permissions. The standard permission set is 644 for files and 755 for directories. However, some files (like wp-config.php) may require stricter permissions. Be cautious when changing permissions, as overly permissive settings can create security vulnerabilities.
Keep in mind, though, that this isn’t an exhaustive list. Ideally, you/your host can resolve the 500 errors above relatively quickly and easily. But if you have persistent errors, database issues, server config problems, a custom code error, or malware you’ll probably need more assistance (unless you know a sys admin or developer).
Feel free to reach out if you want more details/assistance or want clarification on any of these steps.