Help

How to fix the WordPress 500 internal server error

A 500 internal server error means the server failed to run the page, without saying why. In WordPress, the cause is usually a broken .htaccess file, a plugin or theme, a PHP memory limit that is too low, wrong file permissions, or a PHP version your site’s code does not support. Your posts and pages are usually safe.

Updated · HostUpIndia team

What causes a 500 error in WordPress

The error is generic: the server could not run the page. In WordPress, it is almost always one of these.

  • A broken .htaccess file, often after a plugin or permalink change.
  • A plugin or theme with a PHP error, often right after an update.
  • A PHP memory limit too low for your plugins.
  • Wrong permissions on files or folders.
  • A PHP version your WordPress, plugins or theme do not support.
  • Damaged WordPress core files, after a failed update.

Read the error log

The log names the file and line that failed, and so which fix below you need. An .htaccess mistake shows in cPanel’s Errors list, not in the WordPress log.

  • In cPanel, open Metrics › Errors. It lists the latest errors for your sites.
  • In File Manager, look for a file named error_log in public_html or wp-admin. PHP writes its errors there on many cPanel servers.
  • For the WordPress log, edit wp-config.php, find define( 'WP_DEBUG', false ); and change false to true. If there is no such line, add define( 'WP_DEBUG', true ); above the “stop editing” comment.
  • Below it, add define( 'WP_DEBUG_LOG', true ); and define( 'WP_DEBUG_DISPLAY', false );, then save.
  • Reload the page, then open wp-content/debug.log.
  • When you are done, set WP_DEBUG back to false, remove the two lines you added and delete debug.log. Anyone can open it in a browser.

Reset the .htaccess file

The quickest fix to try. Renaming the file keeps it, so you can put it back.

  • Sign in to cPanel, open File Manager and go to the folder WordPress is in, usually public_html.
  • If you do not see .htaccess, click Settings, tick Show Hidden Files (dotfiles) and click Save.
  • Rename .htaccess to .htaccess-old and reload your site.
  • If the error stays, rename .htaccess-old back to .htaccess. The cause is elsewhere.
  • If the site loads, sign in to WordPress, go to Settings › Permalinks and click Save Changes. WordPress writes a new .htaccess.
  • If WordPress cannot write the file, create .htaccess in the same folder with the default rules for a site at the domain’s root:
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
  • Copy any rules you still need from .htaccess-old, such as an HTTPS redirect, into the new file, outside the WordPress lines.
  • If you set your PHP version in MultiPHP Manager, set it again there. cPanel keeps that setting in .htaccess.

Turn off plugins and the theme

A plugin or theme update is a common trigger. If you can sign in to WordPress, turn plugins off under Plugins. If you cannot, use File Manager.

If WordPress shows “There has been a critical error on this website” instead, see how to fix a WordPress critical error.

  • In File Manager, open wp-content and rename plugins to plugins-old.
  • Reload your site. If it loads, a plugin is the cause.
  • Sign in to WordPress and open Plugins. WordPress turns off every plugin it cannot find.
  • Rename the folder back to plugins.
  • Turn plugins on one at a time, reloading your site after each.
  • When the error returns, rename that plugin’s folder to turn it off. Then update it, replace it or ask its developer.
  • If no plugin is the cause, go to Appearance › Themes and activate a default theme, such as Twenty Twenty-Five.
  • If you cannot sign in, rename your theme’s folder in wp-content/themes, then sign in and open Appearance › Themes. WordPress switches to a default theme, if one is installed.

Check PHP memory and version

A site that runs out of memory, or runs on a PHP version its code does not support, can stop with a 500 error.

  • Edit wp-config.php and add define( 'WP_MEMORY_LIMIT', '256M' ); above the “stop editing” comment.
  • If the error stays, raise memory_limit in cPanel’s MultiPHP INI Editor, or under Select PHP Version › Options, for example to 256M. Full steps: how to increase the WordPress memory limit.
  • If the error started after a PHP version change, switch back in cPanel’s MultiPHP Manager, or Select PHP Version.
  • Update WordPress, your plugins and your theme, so they support current PHP versions.

Check file permissions and core files

Wrong permissions can stop the server from reading a file, or make it refuse to run one. Core files damaged by a failed update can break every page.

  • In File Manager, check the Permissions column: folders should be 755 and files 644.
  • To change one, select it, click Permissions, enter the number and click Change Permissions.
  • Never use 777. It is unsafe, and many servers return a 500 error for it.
  • If the log points to wp-admin or wp-includes, back up your site first in cPanel › Backup.
  • Download the same WordPress version from wordpress.org and upload its wp-admin and wp-includes folders over yours.
  • Never replace wp-content. It holds your themes, plugins and uploads.
  • Still stuck? Open a ticket with your host. Give the page address and the exact time of the error, so support can find it in the server logs.

WordPress hosting on LiteSpeed

HostUpIndia WordPress hosting comes with WordPress pre-installed on LiteSpeed, NVMe storage, cPanel and free SSL. Daily backups are kept 30 days, so you can restore a copy from before the error.

From ₹149 a month on 3-year billing. Prices exclude 18% GST. See WordPress hosting plans.