Get a free website with any plan

See how
TROUBLESHOOTING

Fixing a 500 Internal Server Error

A 500 Internal Server Error means the server tried to handle your request but ran into something it couldn't recover from. The error itself doesn't tell you much, but the server logs do.

Step 1: Check the error log

The error log tells you specifically what went wrong:

  1. Open cPanel from your hosting service.
  2. Find Error Log under Metrics.
  3. Look at the most recent entries — they're often the cause of your 500.

Typical messages and what they mean:

  • "Premature end of script headers" — PHP crashed before sending output. Look for the script name; that's the broken script.
  • "Allowed memory size exhausted" — script ran out of memory. Raise memory_limit in PHP options or fix the script's memory usage.
  • "Maximum execution time exceeded" — script took too long. Raise max_execution_time or optimize the script.
  • "Permission denied" — file/folder permissions are wrong. See File permissions.
  • "Module not found" — a PHP extension or shared library is missing.
  • "Fatal error: Uncaught Error..." — PHP code error. The message includes the file and line number.
  • "Internal Server Error: ".htaccess syntax error.

Read the most recent few lines; they're usually the cause.

Common causes and fixes

Bad .htaccess

Most common cause of sudden 500s after a config change.

To test: rename .htaccess to .htaccess.bak via FTP. If the site loads, the .htaccess had a bad rule.

To fix:

  • Restore from backup if you have one.
  • Regenerate from scratch: WordPress users go to wp-admin → Settings → Permalinks → Save Changes. WordPress writes a fresh .htaccess.
  • Manually fix the bad rule once you've identified it (the error log usually points at the line number).

PHP code error

A bug in your code throws an unhandled exception. The error log shows the exception, file, and line.

To fix:

  • Read the error message — it's usually specific.
  • Roll back any recent code changes if the 500 started after a deploy.
  • Check WordPress plugin/theme updates if you're on WordPress — see Fixing the WordPress white screen of death (same root cause family).

Out of memory

A script tried to allocate more memory than allowed.

To fix:

  • Raise memory_limit in PHP options (Services → PHP → Edit PHP options).
  • Identify the script using too much memory. Often image-processing code, big data imports, or recursive operations.

Out of execution time

A script took longer than max_execution_time allows (default 30 seconds).

To fix:

  • Raise max_execution_time if the long execution is legitimate.
  • Optimize the script — break work into chunks, run as a background job (cron), use streaming for large data.

File or folder permissions

Wrong permissions can cause 500s if the web server can't read a script:

  • Files should be 644, folders should be 755.
  • wp-config.php should be 600 for WordPress.
  • .htaccess should be 644.

See File permissions.

Missing PHP extension

If your code requires an extension that's not loaded:

  1. Check Services → PHP → look at "Extensions" — toggle on what's needed.
  2. Or move your code to use available extensions.

.user.ini errors

Per-directory PHP overrides via .user.ini can have syntax errors. Same diagnostic as .htaccess: rename to .user.ini.bak, see if the 500 goes away.

Diagnosing live

If the 500 happens in production and you can't easily reproduce it:

  1. Watch the error log livetail -f /home/your-user/logs/error_log from SSH (if available).
  2. Reproduce the request — visit the failing URL.
  3. Watch the log — the new entries are your error.

Or in cPanel's Error Log viewer, just refresh after each request.

Get more error detail

WordPress: turn on WP_DEBUG in wp-config.php:

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

Errors now show inline (in dev) or get logged to wp-content/debug.log.

Custom PHP: at the top of your script, add:

ini_set('display_errors', 1);
error_reporting(E_ALL);

Errors show in the response. Don't leave this on in production.

When to give up and ask

If you've exhausted the basics — checked .htaccess, checked permissions, checked the error log — and you still don't know what's wrong, open a ticket with our team. Include:

  • The URL that's giving the 500.
  • The relevant error log lines.
  • What changed recently (new plugin, code deploy, config change).

We can dig into server-side logs that aren't visible in cPanel and find the cause.

Power-user note

For sites with intermittent 500s (works most of the time, fails occasionally), the cause is often resource exhaustion under load — too many concurrent requests, slow queries piling up, etc. Tools to diagnose:

  • Resource Usage tool in cPanel — shows when CPU/memory/processes peaked.
  • Slow query log for MySQL — finds queries hogging the database.
  • Application performance monitoring (Sentry, New Relic, DataDog) — catches errors with context.

Intermittent 500s often resolve with a plan upgrade or specific application optimization, not config tweaks.

CAN'T FIND IT?

Real humans answer fast.

Hosting with us? Open a ticket and a real person replies - no scripts, no upsells. Still choosing a host? The same team is included with every plan, from day one.