How to Fix Internal Server Error in WordPress

How to Fix Internal Server Error in WordPress

The internal server error is one of the most common WordPress errors. Mostly, this error occurs on the root directory, where the root files are located. It’s a frustrating issue for many beginners as the internal server error doesn’t give any other information.

So are you looking for how to fix the internal server error in WordPress? Then read this article as I have given all the possible solutions to fix the error. Let’s go:

internal-server-error
Internal Server Error

What Causes an Internal Server Error?

There are several possible culprits, namely:

  • Plugins
  • Topic
  • WordPress installation
  • .Htaccess file
  • PHP memory
  • Your hosting

To know more about them, my suggestion is to read all the contents given below:

Regenerate the .htaccess File

To eliminate the biggest suspect of an internal server error, I always start by checking the .htaccess file.

The problem with this file is that there are many plugins that add lines to it, so sometimes guessing what could have caused the problem is difficult, especially if you do not have server knowledge.

So the easiest, and safest, is to do the following:

  1. Access by FTP or the cPanel of your hosting and rename the current .htaccess file to something else.
  2. If you go to your site and the internal server error has been fixed, go to your WordPress dashboard, that is, to https://yourdomain.com/wp-admin/
  3. Go to Settings> Permalinks and Save changes without modifying any settings.

htaccess-permalink

What you have done is force WordPress to generate a new clean .htaccess file, only with the WordPress rules, and by the way, you already know that it was something in the old .htaccess that was causing the error.

Now you have to check what was in that file, that is why you have the copy, which caused the error.

Disable Plugins

The next possible culprit is plugins, simply because they can load functions that insert lines into the .htaccess file or break WordPress and your entire installation if there is a programming problem.

Access your WordPress installation by FTP or cPanel and rename the plugins folder, change the folder that is in the path / wp-content / plugins / to something else, for example, / wp-content / plugins_rotos /

What you do with this is to deactivate all the plugins automatically, because WordPress does not find the standard path where the plugins are installed.

Visit your site, and if the internal server error has been fixed, rename the plugins folder back to its original name.

Now you will be able to access the WordPress dashboard again, but with all the plugins inactive.

The following you already know, or imagine, right? You have to activate plugins one by one and check which one is causing the internal server error.

Once located, deactivate it, rename its folder or delete it directly via FTP or your hosting panel, get in touch with the developer to let them know and offer you a solution, and look for an alternative plugin that offers you the same functionality but without mistakes.

Change the Subject Temporarily

If not the plugins, also the active theme could cause an internal server error.

Themes not only make your website look beautiful and functional, but they also include (more and more) internal functions, practically plugins, which, like your plugins, can cause an internal server error.

Here the solution is similar to the previous one, and I will take advantage of a not very well-known WordPress trick, at least not as well known as I would like.

Again, access your installation by FTP or cPanel and check if, in addition to the currently active theme, you have installed a recent default WordPress theme.

If you don’t have any of these themes installed, download it from the official WordPress themes directory and upload it to your WordPress installation themes folder ( / wp-content / themes / ).

Once done, rename the current theme folder to whatever you want . For example, from  / wp-content / themes / my-theme / to / wp-content / themes / my-broken-theme / .

In a few seconds WordPress will detect that the current theme is not available in the path stored in the database and will switch to the first default theme. Now visit your site to see if this has fixed the internal server error.

If so then talk to the developer, retrieve a clean copy of your favorite theme or find another that offers the same but without errors.

You can also read: How to Fix Syntax Errors in WordPress

Upload PHP Memory

Another possible culprit may be that you have little memory for PHP, a directive that is usually set default by hosting companies, but that I can manipulate to some extent.

If none of the above has worked this could be the problem, so I will try to force the available memory for PHP, the programming language that WordPress uses, its plugins, and themes a mass.

This is because the processes on your website exceed the available memory at any time and may force internal server errors. For example, an automated task of a plugin that coincides with the publication of a post.

Whatever it is, we’re going to increase the PHP memory limit to see if that was it. To achieve this I have to try to jump the limits imposed by the server, which I can achieve in several ways.

Increase PHP Memory Limit from .htaccess

Add the following line to the .htaccess file :

php_value memory_limit 512M

Save the changes and see if the internal server error has been fixed.

Increase PHP Memory Limit from wp-config.php

If the above does not work for you, delete that line and add this one to your wp-config.php file :

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

Again, save the changes and check your website to see if you no longer have the Internal Server Error under your nose.

Increase PHP Memory Limit from php.ini

If you have full access to all paths on your hosting, locate the PHP parameter configuration file, called php.ini, and change the PHP memory limit line to these values:
memory_limit = 512M; Maximum amount of memory a script may consume (256MB)

If you don’t have access to the path of the original php.ini file you can create one yourself in the wp-admin folder and add the following:

memory_limit = 512M

And if All Else Fails, Call Your Hosting

If none of the above solves the problem, talk to your hosting provider, and inform them about your hosting. They have access to your entire server, to the error logs, and will be able to more easily determine what caused the problem.

In addition, they may increase the available memory, even temporarily, so that you can review the steps we have seen previously.

Conclusion

Anyone using WordPress has experienced an internal server error, at least once. As we have seen, solving an internal error 500 of the WordPress server is not that difficult if you know how to do it.

It seems that in real life, the first thing to do is find out the cause of a problem. After that, you can use online sources, ask friends, developers, or even your hosting provider. But still, if you face any trouble, you can share your problem by commenting in the comment box below. Our expert community will help you very soon to solve your problem.

Posted in

Want to learn step-by-step how To build a wordpress website? Need help from our community?

My top recommendations

Ready to learn about WordPress weekly?

I would love to ...

I am too busy to spam you everyday! Your email is safe with me, trust me I hate my email to be sold to others as much as you do!