How to Fix the 500 Internal Server Error in WordPress

16 min read

Share
A browser window with a server and a warning sign, and tools to fix it

The 500 Internal Server Error means the server hit a problem it could not handle, but it does not say what. In WordPress, the cause is usually one of a few things: a conflicting plugin, a broken .htaccess file, PHP limits or the hosting's resource limits, a PHP version the site cannot run on, or a file upload the server cannot process.

I have fixed this error many times. The trick is not to guess: first find where the error appears (the whole site, only wp-admin, or only when uploading an image), then read the error log, which almost always names the cause.

Quick checklist: fix the 500 error in WordPress

  1. Note when it happens: whole site, only admin, only on one action (saving, uploading).
  2. Read the error log in cPanel or wp-content/debug.log.
  3. Rename .htaccess and reload the site.
  4. Disable plugins by renaming the plugins folder, then find the one causing it.
  5. Check Resource Usage in cPanel for CPU, memory and process limits.
  6. Raise the PHP memory limit and check the PHP version.
  7. For image uploads: convert the image properly, fix the file name, and resize large photos.
  8. Elementor won't open? Enable the editor loader option, clear its cache, turn off Element Caching, or roll back.
  9. Check file permissions, ModSecurity, and reinstall core files if needed.
  10. Still failing? Contact the host with the exact error log line.

Where does the 500 error appear? It tells you a lot

Where you see the errorMost likely cause
Whole site, front end and admin.htaccess, a plugin or theme, PHP version, resource limits
Only in wp-adminA plugin that runs in the admin, or memory limits
Only when opening or saving a page in ElementorAn Elementor update, its loader or cache settings, ModSecurity, memory
Only when saving a file in the theme or plugin editorA server rule blocking the edit; edit in File Manager instead
Only when uploading an image or fileThe file itself (format, name, size), memory, or the image library
Comes and goes, mostly at busy timesHosting resource limits (CPU, entry processes)
Right after an update or new pluginThat update or plugin

Remember what you changed last. A 500 error that started right after installing a plugin, updating a theme or changing the PHP version is almost always caused by that change.

Step 1: Read the error log first

The 500 page hides the real error, but the server writes it down.

  • cPanel > Errors (under Metrics) shows the latest server errors with the file and line.
  • An error_log file often appears in public_html or wp-admin. Open it and read the last lines.
  • WordPress's own log: add these lines to wp-config.php, reload the page, then open wp-content/debug.log:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

Look for lines with Fatal error, Allowed memory size exhausted, ModSecurity, Premature end of script headers or Invalid command. A plugin or theme folder name in the path (/plugins/some-plugin/) points straight at the culprit. My critical error guide explains how to read these lines in more detail.

Step 2: Reset the .htaccess file

A broken .htaccess is one of the most common causes of a site-wide 500 error. A plugin may have written bad rules, or someone added a line the server does not accept.

  1. In File Manager, turn on Show Hidden Files and open public_html.
  2. Rename .htaccess to .htaccess-old.
  3. Reload the site.

If it loads, the file was the problem. Go to Settings > Permalinks and click Save Changes; WordPress creates a fresh, clean .htaccess. Then add back only the custom rules you really need, one at a time.

Step 3: Find the conflicting plugin

Plugin conflicts are the cause I see most often: two plugins doing the same job (two caching or two security plugins), a plugin that does not support your PHP version, or an update that broke.

If you can open wp-admin: go to Plugins, deactivate all, and check the site. Then activate them one by one, reloading each time. The one that brings the error back is the cause.

If you cannot open wp-admin:

  1. In File Manager, go to wp-content.
  2. Rename plugins to plugins-off. WordPress now runs with no plugins.
  3. If the site loads, rename the folder back to plugins. All plugins are now inactive.
  4. In wp-admin, activate them one at a time until the error returns.

To test the theme, rename your active theme's folder in wp-content/themes. WordPress falls back to a default theme like Twenty Twenty-Five, if one is installed.

Step 4: Check Resource Usage in cPanel

On shared hosting, every account has limits for CPU, memory (RAM), entry processes (how many requests run at once) and disk I/O. When the site hits them, visitors get 500 or 508 Resource Limit Is Reached errors, often only at busy times.

  1. In cPanel, open Resource Usage (it may be called CPU and Concurrent Connection Usage).
  2. Look for days marked as limited or with faults, and which resource hit the limit.
  3. Click the detailed view to see the times. Do they match when the site showed errors?

Common reasons the limits are reached, and what helps:

  • Heavy plugins or many plugins doing work on every page: remove what you do not need.
  • No caching: a caching plugin (LiteSpeed Cache on LiteSpeed servers, or another one) cuts the load a lot.
  • Bots and attacks hitting wp-login.php or xmlrpc.php: block them with a security plugin or Cloudflare.
  • Cron jobs and backups running at busy times: move them to the night.
  • Image processing: uploading many large photos at once uses a lot of memory and CPU.

If the site has simply outgrown the plan, no tweak will fix it. Ask the host about the limits, or move to a bigger plan or VPS.

Step 5: Raise the PHP memory limit

When a page needs more memory than PHP allows, the log shows Allowed memory size of ... bytes exhausted, and the browser often shows a 500 error.

Add this to wp-config.php, above /* That's all, stop editing! */:

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

WordPress cannot go above the server's own limit, so also check memory_limit in cPanel's MultiPHP INI Editor or Select PHP Version > Options, and raise it there if needed. If a page still needs huge amounts of memory, a plugin is usually doing something wrong, so go back to Step 3.

Step 6: Check the PHP version

A plugin or theme written for old PHP can crash on PHP 8, and a new plugin may need a newer PHP than the server runs. Both can show as a 500 error.

  1. In cPanel, open MultiPHP Manager or Select PHP Version.
  2. Note the current version. If you changed it recently, switch back and test.
  3. Otherwise, update the plugins and theme first, then move to a supported version (PHP 8.2 or 8.3).

Step 7: Fix 500 errors when uploading images

This is a case many guides skip. The site works fine, but when you upload an image to the Media Library, you get "HTTP error", a 500 error, or "The server cannot process the image". In my experience the cause is usually the file itself.

Badly converted or corrupt images

An image can look fine on your computer and still be broken inside:

  • an SVG that is corrupt or was exported with unusual code;
  • a file whose extension does not match its real format, for example a WebP or HEIC photo that was simply renamed to .jpg instead of being converted;
  • an image saved by an app that wrote damaged or unusual data.

WordPress and the server's image library (Imagick or GD) read the file's real content, not just its name. When the content does not match or cannot be decoded, the upload fails.

Fix: convert the image properly with a real converter, not by renaming it. For example, turn a WebP into a real JPG or PNG, or an SVG into a PNG if you do not need it to stay vector.

Remove extra extensions and odd characters from the file name

File names like these cause trouble:

  • double extensions: example.jpeg.jpg, banner.png.webp;
  • spaces and symbols: final banner (2)#.jpg;
  • non-English characters in the name.

Some server firewalls treat double extensions as suspicious and block the upload. Rename the file to something simple, with one extension: example.jpg, home-banner.webp.

Try uploading through Elementor

When the Media Library upload kept failing for one file, sometimes it went through when I uploaded it from inside Elementor (an Image widget > Choose Image > Upload Files). It goes into the same Media Library.

It is a workaround, not a fix. If the file still fails, or fails again later, convert it properly and fix the name as above.

Large photos and the image library

Big photos from phones and cameras (5,000 pixels or more) need a lot of memory to process. WordPress also creates several smaller sizes of each upload, which multiplies the work.

  • Resize and compress before uploading. Around 2,000 to 2,560 pixels wide is plenty for most websites; WordPress itself scales down anything above 2,560 pixels.
  • If uploads still fail on a shared host, the Imagick library may be hitting limits. Adding this line at the top of .htaccess often helps:
SetEnv MAGICK_THREAD_LIMIT 1

Or make WordPress use the GD library instead of Imagick, with a small snippet (in a code snippets plugin or a child theme):

add_filter( 'wp_image_editors', function () {
    return array( 'WP_Image_Editor_GD', 'WP_Image_Editor_Imagick' );
} );

Uploading SVG files safely

WordPress does not allow SVG uploads by default, because an SVG can contain scripts. Adding SVG support with a quick code snippet from the internet is a common cause of a 500 error when the code is pasted wrongly into functions.php. Use a plugin that sanitises SVGs, such as Safe SVG, instead, and keep SVGs simple and clean.

Step 8: Elementor pages won't open? Fix the 500 error in Elementor

Elementor is behind many of the 500 errors I fix. The site may load fine, but Edit with Elementor gets stuck on the loading screen, or the editor shows Server Error 500 when it opens or when you click Update. Here is what I try, in this order.

Change two settings in Elementor

Go to Elementor > Settings > Advanced (in newer versions: Elementor > Editor > Settings, then the Advanced tab) and look for these two options:

  • Switch Editor Loader Method: set it to Enable. Elementor describes it as an option for server configuration conflicts. It changes how the editor loads, and on some hosts it is exactly what stops the 500 error.
  • Enable Unfiltered File Uploads: set it to Enable if the error appears when you add an SVG icon or import a JSON template or kit. Elementor then accepts these files and tries to clean out harmful code.

Save, then try opening the page in Elementor again.

Clear Elementor's cache and test in Safe Mode

In Elementor > Tools > General:

  1. Click Clear Files & Data under Elementor Cache. Elementor deletes its old CSS files and cached data and builds them again on the next visit.
  2. Set Safe Mode to Enable and open the editor. Safe Mode loads the editor without your theme and other plugins. If the editor now opens, another plugin or the theme is the cause, so go back to Step 3.
  3. Turn Safe Mode off again when you are done.

Turn off Element Caching, and don't stack caches

In Elementor > Settings > Performance, scroll to the end. There is an Element Caching option, which saves the output of widgets. Set it to Disable and test again.

If you also have a caching plugin (LiteSpeed Cache, WP Rocket, W3 Total Cache and so on), two layers of caching can clash. Test with the caching plugin deactivated, then with Element Caching off, and if needed with both off. Keep one caching layer that works, not two that fight each other.

Roll back Elementor to the previous version

If the 500 error started right after an Elementor update, roll back:

  1. Open Elementor > Tools > Version Control.
  2. Under Rollback Version, pick the version before the current one and click Reinstall.
  3. If you have Elementor Pro, do the same under Rollback Pro Version.
  4. Test the editor. If the error is still there, roll back one more version and test again. Keep trying until the editor works.

Elementor asks you to back up the database first, and you should: an older version reading data saved by a newer one can cause its own problems.

Bought Elementor Pro from a third party? If your Pro copy did not come with an Elementor account licence (for example from a reseller or a theme bundle), the Pro rollback list may not appear. In that case, use the zip of the previous Pro version if you kept it: go to Plugins > Add New > Upload Plugin, upload it, and choose Replace current with uploaded. This is a good reason to keep the zip of every plugin version you install from outside wordpress.org.

Once the editor works again, stay on that version and wait for the next update before trying again.

What other site owners found

I compared my fixes with WordPress.org support threads and Elementor troubleshooting guides from hosts and plugin makers. A few points came up again and again:

  • Pro is often the one that breaks. Several users found the error disappeared when they deactivated only Elementor Pro and kept the free plugin. Test that first: it tells you which of the two to roll back.
  • Add-on plugins need to match too. Widget packs built on Elementor (Essential Addons, Royal Addons, theme companion plugins) can break after an Elementor update. Some users had to roll back or update an add-on together with Elementor.
  • Memory is the first suspect in many guides. Check Elementor > System Info for the PHP memory limit. If it shows 128 MB or less, raise it to 256 MB, or 512 MB on a large site (Step 5). Some hosts lock this value; then ask their support.
  • 500 or 403 tells you different things. Open the browser's developer tools (F12 > Network), load the editor, and look for a failed admin-ajax.php or REST request. A 500 usually points to memory or a PHP error; a 403 points to a firewall such as ModSecurity blocking Elementor. Ask the host to whitelist the rule (Step 9).
  • Rolling back does not fix everything. If two or three older versions don't help, the cause is probably not the update. Go back to the error log in Step 1.

Step 9: Other causes to check

The theme or plugin file editor gives a 500 error

If you edit a file from Appearance > Theme File Editor or Plugins > Plugin File Editor and saving gives a 500 error, do not keep trying there. Make the change from the backend instead: open cPanel > File Manager, go to wp-content/themes/your-theme or wp-content/plugins/plugin-name, and edit the file there.

Be careful: one missing semicolon or bracket in a PHP file can take the whole site down. You may then see a white screen, "There has been a critical error", or the browser saying this site can't be reached. Before editing, download a copy of the file so you can put the original back in seconds. A child theme is the safer place for your own changes.

File permissions

Wrong permissions can make the server refuse to run files. The usual safe values:

  • folders: 755;
  • files: 644;
  • wp-config.php: 640 or 600 for extra safety, if your host allows it.

In File Manager, right-click a file or folder and choose Change Permissions. Never set anything to 777.

ModSecurity blocking a request

If the 500 (or 403) error appears only when you save a page, submit a form or use a page builder, the host's ModSecurity firewall may be blocking the request. In cPanel, open ModSecurity and turn it off for the domain briefly to test. If that fixes it, turn it back on and ask the host to whitelist the specific rule; do not leave the firewall off.

Corrupted WordPress core files

A failed update can leave wp-admin or wp-includes incomplete. Download WordPress from wordpress.org and upload fresh wp-admin and wp-includes folders, without touching wp-content or wp-config.php. The critical error guide shows the safe way.

A server-side problem

If none of the above helps, or several sites on the same hosting fail together, the cause may be on the server: PHP-FPM out of workers, a full disk, or a server misconfiguration.

When to contact your hosting provider

Send the host a ticket with:

  • the URL and the time the error happened;
  • the exact lines from the error log;
  • what you already tried (.htaccess, plugins, memory, PHP version).

With a specific log line, a good host can usually fix server-side causes in minutes, such as raising a limit, whitelisting a ModSecurity rule or restarting PHP.

How to prevent 500 errors

  • Take a backup before every update and plugin install.
  • Update plugins one at a time on important sites, and test after each.
  • Avoid two plugins for the same job (two caches, two security plugins, two SEO plugins).
  • Keep an eye on Resource Usage in cPanel, and use caching.
  • Convert and compress images properly before uploading, with simple file names.
  • Keep PHP on a supported version, and update plugins before changing it.

Frequently asked questions

Is the 500 error caused by WordPress or by the hosting?

Either. Most 500 errors on WordPress sites come from the site itself (plugins, .htaccess, memory), but resource limits, ModSecurity and server problems are hosting-side. The error log tells you which.

Why do I get "HTTP error" when uploading images in WordPress?

WordPress shows "HTTP error" when the server returns an error during the upload, often a 500. The usual causes are a badly converted or corrupt image, an odd file name, a very large photo, low memory, or the Imagick library hitting limits.

Can a corrupt SVG cause a 500 error?

Yes. A broken or unusual SVG can make the upload or the processing fail. Badly added SVG support code in functions.php can also crash the site. Use a sanitising SVG plugin, or convert the SVG to PNG.

Why does Elementor show a 500 error when I open a page?

Usually because of a recent Elementor update, a mismatch between Elementor and Elementor Pro versions, low PHP memory, or a caching conflict. Enable Switch Editor Loader Method, clear Elementor's cache, turn off Element Caching, and if needed roll back in Elementor > Tools > Version Control.

What is the difference between 500 and 508 errors?

A 500 error is a general server error with many possible causes. A 508 Resource Limit Is Reached error specifically means the hosting account hit its CPU, memory or process limits.

Will I lose my site because of a 500 error?

No. The 500 error stops pages from loading, but your files and database are normally untouched. Once the cause is fixed, the site works again.

More free tools for photos and images

Found this useful? Share it with someone who runs a website.

Share this article