ON THIS PAGE
  1. Quick Diagnosis: Start Here
  2. What Is an HTTP 500 Error?
  3. What Causes HTTP Error 500?
  4. Before You Start
  5. How to Fix an HTTP 500 Error: Step by Step
  6. Step 1: Check how widespread the error is
  7. Step 2: Read the error logs
  8. Step 3: Turn on your CMS’s own error reporting
  9. Step 4: Reset the .htaccess file
  10. Step 5: Disable plugins and extensions
  11. Step 6: Switch to a default theme
  12. Step 7: Check the PHP version
  13. Step 8: Raise PHP memory and execution limits
  14. Step 9: Correct file permissions and ownership
  15. Step 10: Replace the CMS core files
  16. Step 11: Check server services and configuration
  17. Step 12: Restore from a backup
  18. Running Nginx? What’s Different
  19. How 500 Errors Affect Your Search Rankings
  20. How to Prevent HTTP 500 Errors
  21. Conclusion
  22. Frequently Asked Questions

How to Fix HTTP Error 500 (Internal Server Error): A Step-by-Step Guide

A 404 page tells you exactly what went wrong: the address leads nowhere. A 500 page tells you almost nothing. It only says that the server accepted the request, tried to build a response, and failed somewhere along the way. Because that failure usually happens in code or configuration that runs on every request, one 500 error often takes down the whole site rather than a single page.

The list of usual suspects is short, though. 

Broken .htaccess rules, PHP fatal errors, plugin or theme conflicts, exhausted resources, and incorrect file permissions account for the large majority of cases. Your server also records exactly what failed, so in most cases you are one log line away from the answer.

This guide shows you how to confirm the error, read the evidence, jump straight to the most likely fix, and then work outward through the less common causes.

Quick Diagnosis: Start Here

If you already know what changed just before the error appeared, use this table to skip to the right step. If you don’t, start with Step 1 and Step 2.

What you noticedMost likely causeGo to
The error started right after you edited .htaccess or installed a caching, security or redirect pluginInvalid .htaccess directiveStep 4
WordPress shows “There has been a critical error on this website”PHP fatal error in a plugin, theme, or custom codeStep 3
The error appeared right after a plugin, theme or extension install or updateAdd-on conflict or incompatible codeSteps 3, 5, 6
The error started after a PHP version changeCode that is incompatible with the new PHP versionStep 7
The log mentions “Allowed memory size” or “Maximum execution time”PHP memory or time limit reachedStep 8
The error comes and goes, mostly during traffic peaksAccount resource limitsSteps 8, 11
Only certain scripts or pages fail; logs show “Permission denied”File permissions or ownershipStep 9
The error started after an interrupted update or a migrationMissing or corrupted core filesStep 10
Every site on the account fails, including stagingWeb server, PHP-FPM or other service issueStep 11

What Is an HTTP 500 Error?

HTTP 500 (Internal Server Error) is the generic “something broke” response. The HTTP standard, RFC 9110, defines it as the status a server returns when an unexpected condition stops it from completing a request. Servers use it when no more specific error code fits, which is why the page itself is so unhelpful.

Several neighboring 5xx codes look similar in a browser but point to different problems. Make sure you are troubleshooting the right one:

CodeWhat it meansWhere to look first
500 Internal Server ErrorThe web server or application failed while processing the request.Your site’s code, .htaccess, PHP limits, permissions
502 Bad GatewayA proxy (for example, Nginx) received an invalid response from the service behind it.PHP-FPM or another upstream service that crashed or restarted
503 Service UnavailableThe server is temporarily unable to handle requests.Resource limits, overload, or maintenance mode
504 Gateway TimeoutThe upstream service did not answer in time.Slow scripts, long database queries, timeout settings

What Causes HTTP Error 500?

  • Broken or incompatible .htaccess rules

On Apache and LiteSpeed servers, .htaccess lets you add rewrites, redirects, headers, and access rules per directory. Plugins write to it too. A single typo, a directive for a module that is not loaded (such as Header without mod_headers), or a php_value line on a server that runs PHP through PHP-FPM is enough to make every request in that directory fail. Pure Nginx servers ignore .htaccess entirely, so this cause does not apply to them.

  • PHP fatal errors

Any error that stops PHP mid-request ends with a 500 response: a syntax error after a manual edit, a call to a function that doesn’t exist, running out of memory, or exceeding the maximum execution time. The PHP error log names the file and line responsible.

  • Plugin, theme and extension conflicts

Add-ons load their code on every page view. Two plugins that declare the same function, a theme that relies on a plugin you just removed, or an update that requires a newer PHP version can all trigger fatal errors. These problems typically appear immediately after an install or update.

  • PHP version incompatibility

PHP 8 removed several long-deprecated functions, such as create_function() and each(), and turned many warnings into errors. Older plugins, themes, and custom scripts that still use them crash as soon as the site moves to a newer PHP version, whether you changed it or your host upgraded the server.

  • Exhausted server resources

Every hosting account has limits on memory, CPU, and the number of simultaneous PHP processes. Growing traffic, heavier plugins, or a bot crawling aggressively can push a site past those limits. Resource-related 500 errors are usually intermittent and cluster around busy periods.

  • Incorrect file permissions or ownership

If the web server cannot read a script, the request fails. The opposite can also break things: on servers that run PHP as the account user (suPHP or similar), files or folders that are writable by everyone (777) are refused for security reasons and return a 500 instead of running. Files left owned by root after a migration cause similar problems.

  • Failed or interrupted updates

A core, plugin, or theme update that stops halfway, because of a timeout, a full disk, or a dropped connection, can leave a mix of old and new files behind. The result is code that references files or functions that are not there.

  • Server or hosting environment problems

Your site depends on the web server, PHP-FPM, the database server, and other services working together. If one of them is misconfigured or out of disk space, all sites relying on it can return 500 errors. These issues usually affect every site on the account at once.

The table below summarises how each cause usually shows up.

CauseTypical symptomHow often we see it
PHP fatal errors (incl. add-on code)Error or “critical error” screen right after a change; log shows “PHP Fatal error”Very common
.htaccess problemsError starts right after .htaccess edits, plugin activation or migrationVery common
Plugin/theme conflictsError appears after an add-on install or updateCommon
PHP version incompatibilityError starts after a PHP upgrade; log shows “undefined function”Common
Exhausted resourcesIntermittent errors under heavy trafficOccasional
Permissions or ownershipSpecific scripts or folders fail; log shows “Permission denied”Occasional
Server-level issuesAll sites on the account fail, including stagingRare

Before You Start

  1. Confirm the status code. Open your browser’s developer tools, switch to the Network tab, and reload the page; the Status column should show 500. From a terminal, curl -I https://example.com shows the status on the first line. If you use a CDN such as Cloudflare, make sure the 500 comes from your server and not from the CDN itself.
  2. Back up the site as it is now. Even a broken site is worth backing up before you change anything, so every step you take can be undone.
  3. Change one thing at a time and reload after each change. If you change three things at once, you will not know which one fixed the problem, or which one caused the next one.

How to Fix an HTTP 500 Error: Step by Step

Step 1: Check how widespread the error is

Do a hard refresh first (Ctrl+F5 on Windows and Linux, Cmd+Shift+R on macOS). A brief overload or service restart can produce a one-off 500 that disappears on its own. Even if it does, check the logs in Step 2 to see whether it is likely to return.

Next, open a few other URLs: the homepage, an inner page, the admin login, and a static file such as an image. Try a private browser window as well, so you see the page as a logged-out visitor. A site-wide error points to configuration, core code, or the server. An error on one page or one feature points to a specific script, plugin, or permission.

Step 2: Read the error logs

The error log is the single most useful tool for a 500 error. When a request fails, the web server and PHP write the reason, usually with a file name and line number.

  • In SPanel: log in to the User Interface, find the Domains section and click Logs. You can view the access log, the web server error log, and the PHP error log. The last 200 lines of each are shown directly, and you can download the full files.
  • Over SSH: log locations depend on the web server and operating system. 

See also: Where are the server log files for my site?

Web serverDefault error log
Apache (Debian/Ubuntu)/var/log/apache2/error.log
Apache (AlmaLinux/Rocky/CentOS)/var/log/httpd/error_log
Nginx/var/log/nginx/error.log
OpenLiteSpeed and LiteSpeed Enterprise/usr/local/lsws/logs/error.log

To see the latest entries, or to watch new ones arrive while you reload the page, run:

tail -n 50 /var/log/nginx/error.log
tail -f /var/log/nginx/error.log

Here is how to interpret the messages you are most likely to find. The lines below are typical examples; paths and numbers will differ on your server.

Log message (example)What it meansFix
PHP Fatal error: Allowed memory size of 134217728 bytes exhaustedThe script hit the PHP memory limit (128 MB here)Step 8
PHP Fatal error: Maximum execution time of 30 seconds exceededThe script ran longer than PHP allowsStep 8
PHP Fatal error: Uncaught Error: Call to undefined function create_function()Code written for an old PHP versionSteps 5, 7
PHP Parse error: syntax error, unexpected … in wp-config.phpA typo from a manual editUndo the edit
.htaccess: Invalid command ‘php_value’, perhaps misspelled or defined by a module not included in the server configurationphp_value used where PHP runs as PHP-FPM/CGISteps 4, 8
.htaccess: Invalid command ‘Header’ …Directive for an Apache module that isn’t loadedStep 4
Permission deniedThe server can’t read or run a fileStep 9
Rewrite or internal redirection cycle (Nginx)A rewrite rule loops back on itselfNginx section

Tip: the file path in a PHP error usually names the culprit. A path containing wp-content/plugins/plugin-name/ or wp-content/themes/theme-name/ tells you which add-on to disable first.

Step 3: Turn on your CMS’s own error reporting

  • WordPress. Since version 5.2, WordPress catches most fatal errors, shows “There has been a critical error on this website” and emails the site’s admin address a message that names the plugin or theme involved, with a recovery-mode link. Use that link to log in with the broken add-on paused, then deactivate or update it. Check your spam folder if the email doesn’t arrive.

If there’s no email, enable the debug log. Add these lines to wp-config.php above the line that says “That’s all, stop editing!”:

define( ‘WP_DEBUG’, true );
define( ‘WP_DEBUG_LOG’, true );
define( ‘WP_DEBUG_DISPLAY’, false );

Reload the failing page, then open wp-content/debug.log and read the most recent “PHP Fatal error” entry. Set WP_DEBUG back to false and delete the log once you’re done, because the log file can be read by anyone who knows its address.

  • Joomla. In System → Global Configuration → Server, set Error Reporting to Maximum. If the administrator area is down, set public $error_reporting = ‘maximum’; in configuration.php.
  • Drupal. Add $config[‘system.logging’][‘error_level’] = ‘verbose’; to settings.php temporarily, then reload the page to see the full error.

Step 4: Reset the .htaccess file

This step applies to Apache and LiteSpeed servers. Open File Manager in your control panel, or connect over FTP/SFTP, and go to your site’s document root. Make sure hidden files are visible, then rename .htaccess to .htaccess_old and reload the site.

If the site loads, the problem is inside that file. Note that nothing recreates the file automatically: until you add a new one, pretty URLs and any custom rules will not work, and inner pages may return 404 errors.

  • WordPress: log in and go to Settings → Permalinks, then click Save Changes without changing anything. WordPress writes a fresh set of rewrite rules to a new .htaccess. With WP-CLI, run wp rewrite flush –hard. You can also create the file manually with the standard WordPress block:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

  • Joomla: rename the htaccess.txt file that ships with Joomla to .htaccess. 
  • Drupal: copy the .htaccess file from the Drupal package for your exact version.

Then copy your custom directives (redirects, security headers, caching rules) back from .htaccess_old a few lines at a time, reloading after each batch. When the error returns, the last batch contains the faulty line.

Step 5: Disable plugins and extensions

  • If the WordPress dashboard still loads, go to Plugins, select all, choose Deactivate and test the site. Reactivate plugins one by one until the error returns.
  • If the dashboard is down, open File Manager or FTP, go to wp-content and rename the plugins folder to plugins_off. This disables every plugin at once. If the site comes back, rename the folder back to plugins, then rename individual plugin folders one at a time until you find the one that causes the error. With WP-CLI:

wp plugin deactivate –all
wp plugin activate plugin-name

Two places are easy to miss. Must-use plugins in wp-content/mu-plugins are not affected by deactivation, and drop-in files such as advanced-cache.php and object-cache.php in wp-content load even with all plugins off. Rename those temporarily if the error persists.

  • Joomla: go to System → Manage → Extensions and disable recently installed or updated items. If the backend is down, set enabled to 0 for the suspect extension in the #__extensions table (the prefix varies by site) using phpMyAdmin.

Step 6: Switch to a default theme

  • WordPress: in wp-content/themes, rename the folder of your active theme. WordPress then falls back to a default theme, but only if one is installed, so upload a current default theme first if you deleted them. With WP-CLI: wp theme activate twentytwentyfive (or another installed default theme).
  • Joomla 4 and 5: the default site template is Cassiopeia. In phpMyAdmin, open the #__template_styles table, set home to 1 on the Cassiopeia row where client_id is 0, and set home to 0 on your current template’s row.
  • Drupal 9.4 and later: the default front-end theme is Olivero (Claro is the administration theme). Switch with Drush instead of editing the database:

drush theme:install olivero
drush config:set system.theme default olivero -y

If the site loads with the default theme, the problem is in your theme or its interaction with a plugin. Update the theme or contact its developer with the error from your log.

Step 7: Check the PHP version

If the error started after a PHP upgrade, switch the domain back to the previous version to confirm the cause. In SPanel, open PHP Manager under Tools and choose the PHP version for the domain.

Treat this as a temporary measure. Update or replace the plugins, themes, or scripts named in the log, then move back to a supported PHP version. Older PHP releases stop receiving security fixes.

Step 8: Raise PHP memory and execution limits

Raise limits only when the log shows “Allowed memory size … exhausted” or “Maximum execution time … exceeded”. Raising them blindly can hide a plugin that leaks memory.

In SPanel: go to the User Interface, open PHP Manager in the Tools section, click Actions next to your domain, and choose PHP INI Editor. Set memory_limit (for example 256M or 512M) and, if needed, max_execution_time, then click Change.

Without SPanel, the right method depends on how PHP runs. Check the “Server API” line in phpinfo():

PHP handlerWhere to set the limit
PHP-FPM, FastCGI, CGI, suPHPCreate or edit .user.ini in the document root. PHP picks up changes within about 5 minutes (the default user_ini.cache_ttl).
Apache module (mod_php) or LiteSpeed LSAPI.htaccess with php_value. Note that mod_php does not read .user.ini files.

Example .user.ini:

memory_limit = 256M
max_execution_time = 120

Example .htaccess line (mod_php or LiteSpeed only):

php_value memory_limit 256M

Warning: on servers that run PHP-FPM, a php_value line in .htaccess is itself a common cause of 500 errors. The log will say “Invalid command ‘php_value'”. If you see that message, remove the line and use .user.ini instead.

WordPress can also request more memory in wp-config.php. It asks PHP for this amount, but cannot exceed a hard limit set by your host:

define( ‘WP_MEMORY_LIMIT’, ‘256M’ );

If your site regularly runs out of resources, see how to reduce CPU usage on your hosting account or consider a plan with higher limits.

Step 9: Correct file permissions and ownership

For most PHP sites, folders should be 755 and files 644. Sensitive configuration files such as WordPress’s wp-config.php can be tightened further (for example, 640 or 600, or 440/400 on some setups); check your CMS’s hardening documentation for what works with your server. Never use 777.

To reset permissions in bulk over SSH, run these commands from your document root:

find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;

Ownership matters too. After a migration or a manual upload as root, files may belong to the wrong user. They should be owned by your hosting account user. If you don’t have access to change ownership, ask your host’s support team.

Step 10: Replace the CMS core files

If an update was interrupted or core files were edited, reinstalling the core usually fixes it. Download the same version you are running from the official source and upload it over your existing installation.

  • WordPress: replace the wp-admin and wp-includes folders and the files in the root directory, but do not overwrite wp-content (your themes, plugins and uploads) or wp-config.php. With WP-CLI, you can check which core files have changed and reinstall the core without touching your content:

wp core verify-checksums
wp core download –skip-content –force

  • For Joomla and Drupal, use the official update package for your installed version, not the full install package, and follow the CMS’s upgrade documentation. Take a full backup before you start.

Step 11: Check server services and configuration

  • On shared hosting, contact support. Include the URL, the time the error started, and the relevant log lines; this speeds up the investigation considerably.
  • On a VPS or dedicated server with SPanel, open the Admin Interface and go to Server Information → Service Status. The active web server (Apache, Nginx, OpenLiteSpeed or LiteSpeed Enterprise) is at the top of the list, and PHP-FPM is at the bottom; each has a Restart button.

Also check:

  • Disk space: run df -h. A full disk stops PHP from writing sessions, cache, and uploads.
  • Recent configuration changes: test them before reloading the service with nginx -t or apachectl configtest.
  • The database: if MySQL/MariaDB is down, WordPress usually shows “Error establishing a database connection” rather than a 500. Other applications may return a 500 instead.

Step 12: Restore from a backup

If nothing else works, or the site has to come back immediately, restore the most recent backup taken before the error started. Keep in mind:

  • Anything created after that backup (orders, form entries, comments, new posts) will be lost. On ecommerce sites, export recent orders first.
  • Restoring files alone is often enough. Restore the database too only if the problem is in the data.
  • A backup restore fixes the symptom, not the cause. If an automatic update triggered the error, it can happen again, so find the cause in the logs before you re-enable updates.

Running Nginx? What’s Different

Nginx does not read .htaccess files, so Step 4 does not apply. Rewrite rules live in the server block configuration. After any change, test it with nginx -t before reloading. A common Nginx-specific cause of 500 errors is a rewrite rule that sends the request back to itself; the error log reports it as a “rewrite or internal redirection cycle”. If Nginx is only acting as a proxy in front of Apache, the .htaccess steps still apply to the Apache side.

How 500 Errors Affect Your Search Rankings

A short outage won’t hurt your rankings, but a long one can. According to Google’s documentation, server errors make Google’s crawlers slow down temporarily. Pages that are already indexed stay in the index for a while, but they are eventually dropped if the errors continue, and Google ignores any content returned with a 5xx status.

  • Planned maintenance: return 503 Service Unavailable with a Retry-After header instead of letting the site throw 500 errors.
  • After the fix: check the Page indexing and Crawl stats reports in Google Search Console, and use URL Inspection to request recrawling of your most important pages.

How to Prevent HTTP 500 Errors

  • Test updates on staging first. Apply core, plugin, theme, and PHP updates to a staging copy before production. 
  • Keep automatic off-site backups and test restores. A backup you have never restored is a hope, not a plan.
  • Monitor uptime and status codes. An external monitor that alerts you on 5xx responses tells you about an outage before your visitors do.
  • Watch resource trends. Use your control panel’s resource graphs to spot steady growth and upgrade before you hit the limits.
  • Check compatibility before PHP upgrades. Confirm that your plugins and themes support the new version.
  • Document your .htaccess changes. Comment custom directives and keep a known-good copy.
  • Log errors, don’t display them. Keep error logging on in production with on-screen display off.

Conclusion

A 500 error looks vague, but the server almost always knows what went wrong. Confirm the status code, read the logs, use the quick-diagnosis table to go straight to the likely cause, and change one thing at a time. That turns an intimidating blank page into a short, ordered checklist, and the prevention habits above make it much less likely you will need it again.

Frequently Asked Questions

Q: What does HTTP error 500 mean?

A: It means the server hit an unexpected problem while processing the request and couldn’t complete it. It is a general-purpose error, so the details are in the server and PHP error logs, not on the error page.

Q: Is a 500 error my fault or my hosting provider’s?

A: Most 500 errors come from something inside the account: code, plugins, .htaccess or PHP settings. If every site on the account fails at the same time, including staging, or the logs point to a stopped service, the cause is more likely at server level. On shared hosting that is your host’s job; on a VPS you manage, you may be able to fix it yourself with Step 11.

Q: Can a PHP syntax error cause a 500 error?

A: Yes. A syntax error in any PHP file loaded during the request stops it with a fatal error. The PHP error log shows the file and line number, which is usually the last file you edited.

Q: How do I fix a 500 error in WordPress?

A: Check your admin inbox for the recovery-mode email first. If there isn’t one, enable the debug log (Step 3). The log usually names the plugin or theme at fault. Otherwise, disable plugins (Step 5), switch to a default theme (Step 6), reset .htaccess and re-save permalinks (Step 4), and check PHP memory (Step 8).

Q: Will clearing my browser cache fix a 500 error?

A: Rarely, because the problem is on the server. The reverse is common, though: after you fix the error, a caching plugin or CDN may keep serving the cached error page. Purge your page cache and CDN cache after any fix.

Q: Does a 500 error hurt SEO?

A: Brief errors don’t. If they last, Google crawls the site less often and can eventually drop affected pages from its index. Fix the error quickly and use 503 for planned downtime.

Q: Who should I contact if I can’t fix the error?

A: For custom code, contact the developer. For a specific plugin or theme, contact its author with the log line. For server or service problems, contact your host’s support team. In each case, include the URL, the time the error started, and the exact log message.

Was this helpful?

Thank you for your feedback!
You have already answered. Thank you for your feedback!
Security check failed. Please try again.
Rado
Author

Working in the web hosting industry for over 13 years, Rado has inevitably got some insight into the industry. A digital marketer by education, Rado is always putting himself in the client's shoes, trying to see what's best for THEM first. A man of the fine detail, you can often find him spending 10+ minutes wondering over a missing comma or slightly skewed design.