EN · $ USD
Web Hosting and cPanel

500 Internal Server Error: Causes and How to Fix It

6 min read Updated: Sunucu Atlas technical team

In short

A 500 Internal Server Error is a generic HTTP status code that means the server hit an unexpected error while processing the request. On shared hosting, the most common causes are broken .htaccess rules, wrong file permissions (such as 777), a PHP version mismatch, and exceeding the PHP memory limit. The fastest way to find the exact cause is to read the error logs in cPanel and your site's error_log file.

In this guide
  1. What exactly does a 500 error mean?
  2. Step 1: Read the error log
  3. Step 2: Disable the .htaccess file
  4. Step 3: Fix file and folder permissions
  5. Step 4: Fix a PHP version mismatch
  6. Step 5: Memory limit and timeouts
  7. Nothing in the log? Turn on debug mode
  8. Diagnostic flow at a glance
  9. After the fix: keep it from happening again
  10. Next step: hosting that makes errors easy to diagnose

A 500 Internal Server Error is a generic error: the server ran into a problem while handling the request but doesn't tell the visitor what it was. In other words, the message doesn't give you the cause, only that something went wrong. The good news: on shared hosting, the vast majority of 500 errors come down to one of four causes, and the server writes the real cause to the error log. In this guide, instead of guessing, we'll follow a step-by-step diagnostic flow that starts with the log.

What exactly does a 500 error mean?

In HTTP status codes, the 5xx family covers server-side errors. 500 Internal Server Error is the generic response returned when no more specific code (like 502, 503 or 504) fits. The web server (LiteSpeed or Apache) either couldn't read a configuration file, a PHP script stopped with a fatal error, or the server refused to run the script for security reasons.

A quick summary so you don't mix up similar codes:

CodeWhat it means
500Generic server error: configuration, permission or code error
503Service temporarily unavailable: maintenance or overload
504Gateway timeout: the backend didn't respond in time
508The account hit its resource limit (in CloudLinux environments)

If you see 508 on screen, the problem isn't your code but a resource limit; in that case, go to our 508 Resource Limit Is Reached guide.

Step 1: Read the error log

Start every diagnosis here. A single line in the log can save you hours of trial and error.

  1. In cPanel, open Metrics > Errors. It lists the latest errors the web server recorded for your account, newest first.
  2. For PHP errors, open the error_log file in your site's root folder (public_html or the relevant subfolder) with File Manager.
  3. If you have SSH access, you can watch the last lines directly:
tail -n 50 ~/public_html/error_log
# To watch the error live while refreshing the page:
tail -f ~/public_html/error_log

The messages you see in the log point you straight to one of the steps below:

Message in the logCauseGo to
Invalid command, .htaccess: ...Invalid line in .htaccessStep 2
is writable by group, Permission deniedWrong file/folder permissionsStep 3
Call to undefined function, syntax error, unexpectedPHP version or extension mismatchStep 4
Allowed memory size of ... bytes exhaustedPHP memory limit too lowStep 5
Maximum execution time of ... exceededThe script timed outStep 5

For more examples of reading logs, see our article on cPanel access and error logs.

Step 2: Disable the .htaccess file

.htaccess is a hidden file that defines web server rules per directory. A single typo in it, or a directive for a module the server doesn't have, takes the whole site down with a 500 error.

  1. In File Manager, open the Settings menu at the top right and turn on "Show Hidden Files (dotfiles)."
  2. Rename public_html/.htaccess to .htaccess.bak.
  3. Refresh the site. If it loads, the problem is in that file.
  4. Add the file back line by line to find the faulty rule. If you use WordPress, the default rules are:
# 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

Pay special attention to any php_value or php_flag lines in .htaccess; depending on how PHP is run, these directives may not be supported and will cause a 500 error. Change PHP settings from the cPanel interface instead.

Step 3: Fix file and folder permissions

On shared hosting, PHP scripts run with the account user's privileges. In this model, for security reasons, world-writable (777) files and folders won't execute and produce a 500 error. The correct permissions are:

  • Folders: 755
  • Files: 644
  • Sensitive configuration files like wp-config.php: 600 or 640 (if your hosting setup allows it)

Instead of fixing them one by one, you can fix the whole site in bulk via SSH or cPanel Terminal:

cd ~/public_html
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;

For files uploaded via FTP, ownership matters too: the files must be owned by your account user. If you see a different user in the ls -la output, open a support ticket to have it corrected.

Step 4: Fix a PHP version mismatch

When an old theme or plugin calls a function removed in a newer PHP version, a fatal error occurs. The reverse is also possible: a new plugin may use syntax that the older PHP version on the server doesn't recognize.

  1. In cPanel, open MultiPHP Manager or Select PHP Version.
  2. Note the PHP version used for your domain.
  3. Switch to a version your application supports and test the site.
  4. After changing versions, check that the PHP extensions your application needs, such as mysqli, intl, gd and zip, are enabled.

For a step-by-step walkthrough, see our guide on changing the PHP version in cPanel. In WordPress, if a plugin is causing the problem, temporarily rename the wp-content/plugins folder to disable all plugins, then re-enable them one at a time.

Step 5: Memory limit and timeouts

The Allowed memory size exhausted error means the PHP script exceeded the memory allocated to it. Heavy page builders, large imports and image processing are typical triggers.

  1. In cPanel, open MultiPHP INI Editor or Select PHP Version > Options.
  2. Increase memory_limit as needed (256M is a common starting point for WordPress sites).
  3. For long-running tasks, raise max_execution_time to a reasonable value.

In WordPress, you can also define limits in wp-config.php:

define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );

These values can't exceed your hosting plan's PHP limit. If the memory error keeps coming back, the problem is less the setting and more the plan's total RAM.

Nothing in the log? Turn on debug mode

Some applications catch errors internally and don't write them to the log. To enable detailed logging in WordPress, add these lines to wp-config.php:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

Errors are written to wp-content/debug.log and aren't shown to visitors. After you fix the problem, set WP_DEBUG back to false. For details, see the official WordPress debugging documentation.

Diagnostic flow at a glance

  1. Read the error log and note the message.
  2. Test by renaming the .htaccess file.
  3. Fix permissions to 755/644.
  4. Check the PHP version and extensions.
  5. Raise the memory and time limits.
  6. Roll back the latest change (plugin, theme, code update) or restore from backup.

After the fix: keep it from happening again

Many 500 errors show up right after an update. A few habits greatly reduce the chance of running into the same problem again:

  • Back up before updating: Back up your files and database before changing a theme, plugin or PHP version. Rolling back is often faster than hunting for the error.
  • Make one change at a time: If you update five plugins at once, it's harder to tell which one caused the error.
  • Try big changes in a staging environment: Test risky steps like major PHP version upgrades on a copy on a subdomain first.
  • Check the error_log file regularly: A constantly growing error_log is an early sign of warnings that haven't turned into 500s yet. Clearing up those warnings in time prevents future fatal errors.
  • Delete unused plugins and themes: Old code that's disabled but still installed can cause trouble after a PHP update.

Next step: hosting that makes errors easy to diagnose

The key to fixing a 500 error quickly is easy access to logs and PHP settings. Sunucu Atlas cPanel web hosting plans come with LiteSpeed Web Server and the cPanel interface; you can change the PHP version and limits yourself from the panel. For growing sites that hit frequent memory errors, the SA-CP-5 plan, with 6 GB RAM, a 6-core processor and access and error logs in its feature list, gives you plenty of headroom. For smaller projects, SA-CP-4 with 4 GB RAM is a good middle ground. If you can't interpret a line in your log, add it to a support ticket in Turkish and ask for help.

Frequently asked questions

Is a 500 Internal Server Error caused by the visitor or the server?

A 500 error is server-side; clearing the visitor's browser won't fix it. The cause lies in the web server configuration, file permissions or the site's PHP code.

I get a 500 error in WordPress and can't log in to the admin dashboard. What should I do?

Use File Manager or FTP to rename the wp-content/plugins folder, which disables all plugins. If the site loads, rename the folder back and enable plugins one at a time to find the faulty one.

Will setting file permissions to 777 fix the problem?

No. On shared hosting it usually does the opposite, causing a 500 error and creating a serious security risk. Use 755 for folders and 644 for files.

Where is the error_log file?

PHP errors are usually written to an error_log file in the same folder as the script that failed, most often inside public_html. Web server errors appear under Metrics > Errors in cPanel.

Does a 500 error hurt SEO?

Short-lived errors usually don't cause problems, but if search engine bots see pages returning 500 for a long time, they may crawl less and drop pages from the index. That's why fixing the error quickly matters.

For this guide

Recommended plans

With Sunucu Atlas web hosting, you manage your PHP version, memory limit and error logs yourself in cPanel, so you can diagnose and fix a 500 error in minutes.

SA-CP-1

cPanel
Recommended

20 GB NVMe disk

$0.39/mo

+VAT

  • Memory1 GB
  • LocationIstanbul
  • 1 Hosted Domains
  • 50 GB Traffic
  • 5 Email Account Limit
  • 2 Databases

SA-CP-2

cPanel

40 GB NVMe disk

$0.69/mo

+VAT

  • Processor2 cores
  • Memory2 GB
  • LocationIstanbul
  • 1 Hosted Domains
  • 100 GB Traffic
  • 10 Email Account Limit
  • 5 Databases

SA-CP-3

cPanel

60 GB NVMe disk

$0.98/mo

+VAT

  • Processor3 cores
  • Memory3 GB
  • LocationIstanbul
  • 1 Hosted Domains
  • 200 GB Traffic
  • 25 Email Account Limit
  • 10 Databases

Web Hosting — all plans

Need help with setup?

Send questions about your service in a support ticket, and our technical team will walk you through it step by step.