Warning: Trying to access array offset on value of type null in /home/167840.cloudwaysapps.com/bsrvzwpdrx/public_html/wp-content/themes/salma/inc/header/header-default.php on line 3

How to Fix the WordPress 500 Internal Server Error

enquerer > Blog > Uncategorized > How to Fix the WordPress 500 Internal Server Error
500 -nternal-Server-WordPress-Error

‘500 Internal Server Error’ – This is the most common yet most frustrating error you encounter while using WordPress. The error isn’t even a WordPress error but common among all websites across the world. Still, the error is easily solvable when it comes to WordPress.

Unlike other WordPress errors, the 500 error doesn’t give you the slightest clue of what’s happening. All it shows is the ‘500 Internal Error’ message or a White Screen of Death. But, it isn’t that difficult to figure out the cause of the error. This article is a set of possible solutions for the 500 Internal Server errors. Trying out each fix may consume time, as the range of reasons that trigger the error is too vast.

What is the 500 Internal Server Error?

When you open a website using a browser, it sends a request to the website’s server to process the request. After processing the request, the server will return with the resources to be displayed on the web page with an HTTP header and status code. This is how the web page is displayed in your browser.

The HTTP status code is the index of your browser’s request to display the website. If the website is ready to launch without issues, the server will return a 200 status code. It sends a 500 when it encounters an unknown error and doesn’t know what happened.

The error exists in different names depending on the servers where the websites are hosted and the browsers in which they are displayed. Some websites even create custom error messages and display them instead of the default message. Here are some examples.

  • 500 Internal Server Error
  • Internal Server Error
  • HTTP Error 500
  • Error 500
  • HTTP Error 500 – Internal Server Error

How to Fix 500 Internal Server Error

You can sit for hours and days with an issue in hand. But with proper initial analysis, you can find the actual cause of the problem and find an appropriate solution for it. Same is the case with the 500 Internal Server error on WordPress. Faulty plugins, themes, a corrupt .htaccess file, a low PHP memory limit, etc. are a few causes of this error. By trying and solving each of them, you can finally arrive at a fix for the error. Now, let’s discuss each.

Go to WordPress Debugging Mode

When WordPress displays an unknown error or a white screen of death, it is sure that a time-taking diagnosis is in pending. But, this can be simplified by creating a better insight into what’s happening. Fortunately for WordPress, you have the debugging option to guide you whenever something goes wrong. By activating debugging mode, you’ll get a better idea of what causes the error.

For turning on debugging, open the wp-config.php file of your website and search for the line with WP_DEBUG in it. In the line, set the value to ‘true’. In case you find the line missing, just add it as below.

define( “WP_DEBUG”, true );

Now, when you refresh your website, you will find the 500 error replaced by another significant error which tells you what’s wrong. This will help you to locate the error and solve it easily. Say, if a theme is causing the error, you can deactivate/delete the current theme and switch to a previous theme.

Even if the debug mode doesn’t show you the specific error, you can keep it on until the error is sorted out. It will be useful to you at any stage of the diagnosis. Be sure that you set the value of WP_DEBUG to ‘false’ once all the errors are resolved.

Checking the .htaccess File

One of the few reasons why you will encounter a 500 Internal Server error is due to a corrupt .htaccess file. As a solution, you should first navigate to the folder with the .htaccess file using any FTP client or your cPanel’s file manager (the folder is the one which contains wp-content, wp-admin, etc.).

After spotting the file, right-click and rename the file adding a random prefix, say, like .htaccess_old or something like that. Once you have renamed the file, try refreshing your WordPress site to see if things are straight and working. If everything went well, the issue was with the .htaccess file. Now, navigate to the Permalink page from the Settings in the Dashboard and Save the changes without making any changes. That will create a new .htaccess file in the server which will prevent your WordPress from creating any 404 errors.

Deactivate All Your Plugins and Switch Back to Default Theme

Another definite cause of the Internal Server Error is the faulty plugins or themes installed to your WordPress. The solution for this is too simple but time-consuming.

In the case of plugins, you should try deactivating all plugins together to know if any plugin is causing the issue. For this, you’ll have to use an FTP client and access your WordPress directory. Here, you can see the Plugins folder which you should rename to something else like Plugins-copy or Plugins-old.

Now, refresh your WordPress site. If you find the error solved the problem was definitely with one of the plugins. To identify the faulty plugin, re-rename the folder as Plugins, deactivate all plugins, and try activating the plugins one at a time. Once you activate the faulty plugin, the error will repeat and then you can remove or repair the plugin.

In case the error is made by a theme, you can simply identify this by switching to a previous or default theme like twenty fifteen or twenty sixteen. If the error is solved, it’s definitely your theme who’s the problem maker. You can contact the theme developer to solve the issue with the theme if you wish to reuse the theme.

Increase the PHP Memory

This is counted as one of the issues causing the Internal Server error because there are cases when the memory gets used up and the system cannot identify the reason behind it. The memory exhaustion issue is generally found in shared environments.

In such cases, the first aid to get the website running is to increase the memory limit.  To do this, open the wp-config.php in your WordPress directory and search the line containing WP_MEMORY_LIMIT. Assign a value of ’64M’ to the line. If the line is missing, you can add it as below.

define(‘WP_MEMORY_LIMIT’, ’64M’);

Refresh the website to find the issue solved. But as told, this is just first aid. Next, we should identify the faulty code somewhere inside your WordPress that is exhausting your memory. If you have a website hosting that comes with monitoring, just monitor the resources with one plugin active at a time. This will show you the plugin which is exhausting the memory.

Check the File Permissions


If all the above solutions failed for you, the error causing factor will be the permissions set to the files in your WordPress root directory. Normally, files are set with permissions 755 or 644. Otherwise, they will display a 500 error. You can view the file permissions as a column in the file list when opened with an FTP client.

Normally, permissions for folders are set to 755 and those for everything else will be 644. Following is a list of file permissions as recommended by WordPress Codex.

FilePermissions
Directories755 or 750 (should never be set to 777)
Files 644 or 640
wp-config.php440 or 400 (to prevent access to other website users)

If any file is found with wrong permission, right-click and select file permissions to update it as mentioned above.

Re-upload the WordPress Core Files

You can try this as the final resort to solve your 500 Internal Server error. This method involves a fresh upload of the wp-admin and wp-includes folders from a newly installed WordPress. This replacement will not affect your information. Instead, it replaces corrupted files and reinstates your website’s previous order.

As a first step, download a fresh copy of WordPress zip file from WordPress.org. Unzip the file to find a WordPress folder inside. When you open the folder, you can see the wp-admin, wp-includes, and wp-content folders inside it. Using an FTP client, upload these three folders into the root folder of your website. When asked about overwriting the previous folders, choose ‘Overwrite’ and select ‘Always use this action’.

After replacing the folders, refresh your WordPress site. If it was an issue due to corrupt WordPress files, it would be solved by now.

Wrapping Up

In most cases, Internal Server errors are other error camouflaged by the name. They probably will have no relation with the actual server errors. Such errors can be easily identified and corrected using the fixes we have discussed in this article. In any case if you feel that things are out of your hand, don’t wait for more. Contact your hosting provider and get things right, as they use more sophisticated tools, and have well-experienced professionals to work on the issues.

Hope we covered your issue with one of the above solutions. If you have your experiences or observations in the topic, share them with us in the comment box so that we could improve the article further. Happy WordPressing! 🙂

Have A Look At Our Top Rated WooCommerce Plugins ThemeHigh


Warning: Trying to access array offset on value of type null in /home/167840.cloudwaysapps.com/bsrvzwpdrx/public_html/wp-content/themes/salma/template-parts/about_author.php on line 5

Warning: Trying to access array offset on value of type null in /home/167840.cloudwaysapps.com/bsrvzwpdrx/public_html/wp-content/themes/salma/single.php on line 46

Leave a Comment


Warning: Trying to access array offset on value of type null in /home/167840.cloudwaysapps.com/bsrvzwpdrx/public_html/wp-content/themes/salma/single.php on line 62

Warning: Trying to access array offset on value of type null in /home/167840.cloudwaysapps.com/bsrvzwpdrx/public_html/wp-content/themes/salma/inc/template-functions.php on line 133