Talk to the NOC, IST hours — +91 75994 50220 support@bigdomainhost.com
Guide

How to fix a 500 Internal Server Error

A 500 Internal Server Error tells you the server failed but not why. This guide shows where to find the real message in the error log and how to fix the six causes behind most 500s.

Short answer: A 500 Internal Server Error is the generic code a server returns when an unexpected condition stops it completing a request. The browser page never shows the cause; the server error log does. The usual culprits are a broken .htaccess line, a PHP fatal error or memory limit, 777 permissions or wrong ownership, the wrong PHP version or a missing extension, and failing CGI scripts.

What a 500 Internal Server Error means

A 500 Internal Server Error means the server hit an unexpected condition that stopped it from completing the request. RFC 9110 defines it that way, and it is the generic catch-all for server-side failures: the server knows something went wrong but has no more specific 5xx code to send. The browser page tells you almost nothing. The real cause is written to a log on the server.

Each common cause leaves a different message in the error log, so read the log before you change anything.

Quick-fix checklist for site owners

  1. Note the exact time and URL of the error, then reload once. A 500 that clears straight away was often a deploy or restart in progress.
  2. Read the error log for that time. In cPanel, open Metrics and then Errors. On a VPS, run sudo tail -n 50 on the Apache, Nginx or PHP-FPM log listed below.
  3. Undo your last change: a plugin or theme update, an edit to .htaccess, a PHP version switch or a code deploy.
  4. Rename .htaccess to .htaccess.bak and test again. If the site loads, the problem is in that file.
  5. Check permissions: files 644, folders 755, and nothing set to 777.
  6. Check the PHP version selected for the domain matches what your application supports, and that its required extensions are enabled.

Where to find the real error

ServerWhere the log is
cPanel shared hosting (Apache or LiteSpeed)Metrics > Errors in cPanel shows the latest web server errors for your account; PHP may also write an error_log file in the folder of the script that failed
Apache on Ubuntu or Debian/var/log/apache2/error.log
Apache on AlmaLinux or Rocky/var/log/httpd/error_log
Nginx/var/log/nginx/error.log in the standard Linux packages, set by the error_log directive
PHP-FPMThe error_log setting in the FPM configuration, for example /var/log/php8.3-fpm.log on Ubuntu
ApplicationsTheir own logs, for example storage/logs/laravel.log in Laravel or wp-content/debug.log in WordPress once debug logging is on

To watch errors as they happen while you reload the page:

sudo tail -f /var/log/nginx/error.log /var/log/php8.3-fpm.log

Do not turn on display_errors on a live site to see the message. It shows file paths and sometimes credentials to every visitor. Log the error instead.

Cause 1: a broken .htaccess directive

Apache and LiteSpeed read .htaccess on every request. The Apache documentation says a directive with a syntax error, or one that is not permitted in .htaccess by the server's AllowOverride setting, produces a 500. The log line names the file and the problem:

/home/user/public_html/.htaccess: Invalid command 'RewriteEngin', perhaps misspelled or defined by a module not included in the server configuration
/home/user/public_html/.htaccess: Options not allowed here

Fix the line or remove it. A common trigger is pasting rules that need a module the server does not load, such as php_value lines on Apache where PHP runs through PHP-FPM or CGI rather than as an Apache module (LiteSpeed does accept them). Change PHP settings from the hosting panel or a .user.ini file instead. Nginx does not read .htaccess at all, so on Nginx those rules must be rewritten in the server block.

Cause 2: PHP fatal error or memory exhaustion

When PHP stops on a fatal error before sending any output and display_errors is off, the server returns a 500. Typical log lines:

PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes)
PHP Fatal error:  Uncaught Error: Call to undefined function mysql_connect()
PHP Fatal error:  Maximum execution time of 30 seconds exceeded
  • Memory exhausted. The script needed more than memory_limit (134217728 bytes is 128M). Raise it moderately, for example to 256M, and find out what is using the memory; a loop or an import that loads everything at once is the usual reason.
  • Undefined function or class. Code written for an older PHP version, or a missing extension. See cause 4.
  • Execution time exceeded. The script ran past max_execution_time. Move long jobs such as imports and backups out of the web request, for example to a cron job.

Cause 3: wrong file permissions or ownership

On hosting where PHP and CGI scripts run as your own user, the server checks permissions before it runs anything. Apache's suEXEC documentation lists the checks: the script and its directory must not be writable by anyone except the owner, and the owner must match the user the script runs as. A file set to 777, or one owned by root after an upload over SSH, fails those checks and returns a 500.

Set the standard permissions from the site's root folder. These commands are recursive and cannot be undone, so first check with pwd that you are in the site's own folder (for example public_html), never / or your whole home directory:

find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
chmod 600 wp-config.php   # or 640 if your setup needs group read

The file command removes the execute bit from everything, so set any CGI scripts back to 755 afterwards (see cause 5).

On a VPS you manage yourself, fix ownership too, replacing the user and group with the account that runs PHP. Do not run this on cPanel hosting, where the panel sets ownership for you:

sudo chown -R siteuser:siteuser /home/siteuser/public_html

Never use 777 to make an error go away: any process on the server could then change your files.

Cause 4: wrong PHP version or a missing extension

A PHP upgrade removes old functions, and an older application may stop with an undefined function error. The reverse also happens: a new plugin needs PHP 8 and the domain still runs 7.4. Errors such as Call to undefined function curl_init() or Class "ZipArchive" not found mean the extension that provides that function is not enabled.

On cPanel hosting, change the PHP version and tick the extension for that domain in the panel. On a VPS, install the package, for example on Ubuntu:

sudo apt install php8.3-curl php8.3-zip php8.3-mbstring php8.3-intl
sudo systemctl restart php8.3-fpm

Check what is loaded with php -m, remembering that command-line PHP can be a different version from the one serving the site.

Cause 5: CGI scripts and suEXEC

Perl, Python or shell scripts run through CGI return a 500 if they print anything before the HTTP headers, have Windows line endings, name a wrong interpreter path on the first line, or are not executable. Apache 2.4 typically logs End of script output before headers. Make the script executable with chmod 755, convert line endings with dos2unix script.cgi, and check the first line, for example #!/usr/bin/perl. On suEXEC servers the ownership rules in cause 3 apply as well.

Cause 6: Nginx configuration and timeouts

Nginx itself returns a 500 for some configuration mistakes. A common one is a rewrite loop, logged as rewrite or internal redirection cycle while internally redirecting, usually from a try_files line whose last fallback leads back to itself. Test changes before reloading:

sudo nginx -t && sudo systemctl reload nginx

If the backend is down or too slow rather than failing, you will usually see a 502 Bad Gateway or 504 Gateway Timeout instead of a 500.

WordPress checks

In WordPress, a 500 is nearly always a plugin, a theme, memory or .htaccess. Work through these in order:

  1. Turn on logging in wp-config.php, above the line that says to stop editing: define( 'WP_DEBUG', true );, define( 'WP_DEBUG_LOG', true ); and define( 'WP_DEBUG_DISPLAY', false );. Reload the page and read wp-content/debug.log. The file can be opened by anyone who knows its address, so when you are done set these back to false and delete debug.log.
  2. Rename wp-content/plugins to plugins-off. If the site returns, log in and open the Plugins screen so WordPress deactivates the missing plugins, rename the folder back, then reactivate plugins one at a time until the error returns.
  3. Switch to a default theme by renaming the active theme's folder. WordPress falls back to a default theme such as Twenty Twenty-Five only if one is installed in wp-content/themes.
  4. Regenerate .htaccess by saving Settings > Permalinks once the dashboard loads.
  5. If the log shows memory exhaustion, raise WP_MEMORY_LIMIT in wp-config.php and the PHP memory_limit.

Visitor side vs site owner side

As a visitor, nothing on your device causes a 500. Reload after a minute or two, and if it persists, tell the site owner the page address and the time.

As the owner, the log is the starting point every time. If the error began after moving to a new host, compare PHP versions, extensions, file ownership and .htaccess rules between the old and new servers.

Fixing a 500 error on Bigdomainhost

Web & cPanel hosting and WordPress hosting run on LiteSpeed in Mumbai with cPanel, so the error log is under Metrics > Errors, and PHP 5.6 to 8.4 is selectable per domain with the common extensions available as checkboxes. Every plan includes 30 days of free backups, which helps if you need to roll back a change that broke the site.

On a KVM VPS you have full root access, so the commands above work as written on the Ubuntu, Debian, Rocky and AlmaLinux images, and the out-of-band console in the control panel still gets you in if a change locks you out. The VPS documentation covers access and networking. If you cannot find the cause, call or WhatsApp +91 75994 50220 or email support@bigdomainhost.com with the URL and the time of the error.

Sources (checked )

Answers

Frequently asked questions

Still unsure? Call +91 75994 50220 or write to support@bigdomainhost.com — a human replies in IST hours.

What does 500 Internal Server Error mean?

It means the server ran into an unexpected condition that stopped it from completing the request. It is a generic server-side error, used when no more specific 5xx code fits. The browser page does not say what went wrong; the server's error log records the actual cause, such as a PHP fatal error or a bad .htaccess line.

Is a 500 Internal Server Error my fault as a visitor?

No. A 500 is caused on the server, not by your browser, device or connection. Reload after a minute or two, and if it keeps happening, let the site owner know the page address and the time. Clearing cookies only helps in the rare case where a broken session cookie triggers the error for you alone.

How do I find the cause of a 500 error in cPanel?

Open Metrics and then Errors in cPanel to see the latest web server errors for your account, and check for an error_log file in the folder of the script that failed. Match the entries to the time you saw the error. The message usually names the file and line, or the .htaccess directive at fault.

Can file permissions cause a 500 Internal Server Error?

Yes. Where scripts run as your own user, as with suEXEC, the server refuses to run a file or folder that others can write to, or one owned by a different user. Set folders to 755 and files to 644, fix ownership, and never use 777, which causes the error instead of fixing it.

How do I fix a 500 error in WordPress?

Turn on WP_DEBUG and WP_DEBUG_LOG with display off in wp-config.php and read wp-content/debug.log. Then rename the plugins folder to rule out plugins, switch to a default theme, regenerate .htaccess from the Permalinks screen, and raise WP_MEMORY_LIMIT if the log shows memory exhaustion. Turn debugging off and delete debug.log afterwards.

Support that picks up the phone.

In IST hours, in Hindi or English, and WhatsApp replies fastest at any time. Sales, migration and emergencies all reach the same engineers. No offshore queue, no 48-hour first reply.

Need cPanel or WHM with the ports already sorted?

Web & cPanel hosting comes with cPanel ready to log in to, reseller hosting adds white-label WHM, and a KVM VPS can have cPanel & WHM pre-installed. Call +91 75994 50220 or email support@bigdomainhost.com.