logo
logo
Sign in

What Is An "HTTP Error 500" And How To Fix It On A Website?

avatar
Puneet Sharma
What Is An "HTTP Error 500" And How To Fix It On A Website?

Have you received any HTTP error 500 (Internal Server Error) messages on your website recently? Sometimes, when updating or installing a new plugin or template, your WordPress, PrestaShop or the CMS you use can be dangerous "out of the game" due to this problem.

 

This topic is something much more common than you think and a situation that many of us have previously gone through on more than one occasion. And, if you have reached this tutorial, it is most likely because it is happening to you too and you do not know what it is or how to fix this bug.

 

Take it easy, after a few seconds of nervousness and uncertainty, I must tell you that you have no reason to fear, since today we will tell you what exactly is an error 500 and how to solve this "Internal Server Error" yourself.

 

What is the ERROR 500 "Internal Server Error"?

 

The so-called "HTTP 500 error" is a type of Web server error, usually due to "PHP" issues. That is, it appears when we make a query or request to the server, and it is unable to complete or respond to it.

 

Now, it is when I would love to tell you that there is only one cause and that, therefore, it is very easy to correct this fault ... But, it will be that no, there are many reasons that give rise to this problem.

 

If we analyze this failure, we can find very different reasons why the message of "500 Internal Server Error" appears on our screen.

 

Why Is This Happening And How Can I Fix An Http 500 Error To Get My Website Up And Running Again?

In addition to showing us several reasons why this problem may appear on our site, will also explain some techniques on how to fix a 500 error in WordPress and PrestaShop.

 

I am sure that after reading this tutorial you will stop panicking! Now, I invite you to learn together how to prevent your website from being affected by this common failure.

 

How To Locate An "Http Error 500" And How To Fix It On Our Website, Blog, Or Ecommerce?

 

In this article, I am going to talk to you about the "dreaded" error 500. And I say dreaded because one of its main problems is that, when it appears, we usually have no idea why it did it or where the fault is.

 

Therefore, I am going to tell you what are the main reasons why this happens and, of course, the best ways to solve this problem.

 

How do I find the reason that caused the "500 Internal Server Error"? Since it's not just one specific reason, chances are you'll have to be a detective to find out where the problem is.

 

That is to say, normally you will have to test through the infallible method of "trial and error", ruling out one by one the possible causes, because I already anticipate that the failure message will not give you any type of information or clues.

 

What Can Be The Possible Causes Of Error 500? Best Practices To Solve It?

 

Next, I want to delve into the possible causes of the problem and I'll also tell you what is the best way to solve it.

 

► Damage to the .htaccess file

 

Undoubtedly, this is the most common cause of HTTP error 500, and it is that it is quite common for us to slip into the programming of this file without realizing it.

For example, we use the .htaccess file a lot when we work with redirects. And therefore, it is possible that we have made a mistake in editing it when introducing these redirects.

 

When you have already done it, reload the page and, if you see that the problem has disappeared, it is that indeed, the fault is in this file. If not, you should keep looking for the cause.

► PHP Writing Errors

A poorly done programming in PHP can generate 500 errors, the problem is to see who dares to go through all the lines of their programming one by one, to find where exactly the problem is.

 

The best thing in these cases is to resort to the PHP "error log", in which we can review line by line those that we find in it with the date included.

 

In this way, we can deduce what exactly is the problem we are having with our programming.

 

► PhpVersion Incompatible With Programming

A very classic problem is the incompatibility of the version of PHP installed on the server with our programming.

 

Sometimes it happens because someone has recommended it to you or because the company that manages your server has decided so, they update the PHP version.

 

The problem comes here when your programming uses functions incompatible with that version of PHP, that's when 500 errors can be generated.

 

So it is important to know if someone has updated the PHP version of your server, before going crazy looking for other options.

 

► Server Memory Exhausted

Another problem may have run out of memory on your server for some reason.

 

To check if the fault is here, you must increase the memory limit.

 

There are two options with which you can increase this limit:

 

  • The first is through the php.ini file, in this, you must write the following: memory = 64MB (in this case we limit it to 64MB).
  • The second option is through the .htaccess file, adding the line php_value memory_limit 64M (in this case we put a limit of 64MB).

 

If you see that the bug has been fixed, this is the problem. Ideally, you should contact your hosting provider explaining the case so that they can help you discover the source of the problem.

 

► Incorrect file permissions

Both the files and the directories of your website have permissions, also known as CHMOD, which give read, write, and execute permissions. These are “translated” numerically with 3 digits.

 

If these permissions are wrongly assigned, an “Internal Server Error” can be generated

 

Depending on the function of each file and directory, it should have different permissions, but as a general rule, files should have 644 permissions and directories 755.

 

► Security breach

Mod Security is a server-level mod that helps us protect ourselves from possible security flaws and, therefore, from hacker attacks.

 

When mod_securitydxzzxxx is activated on the server (which it should be), if we use any programming function that is considered insecure by mod security, we will get an HTTP error 500.

 

Therefore, in that case, it is not that we are doing something wrong, it is simply that it has blocked us to avoid problems.

 

From experience in my own blog I know that, in these cases, the solution is to look for what part of the programming is considered insecure, to change it by secure code (for this, we will need a programmer yes or yes).

 

After this, the problem will be solved.

 

How To Fix An "HTTP Error 500" In WordPress?

 

The 500 error in WordPress again can be due to several reasons. But don't worry, I'm going to explain what they are all and how you can solve them.

 

1. When Changing the Theme

 

If you change the Theme of your site and suddenly an error 500 HTTP code appears in WordPress, it is very possible that it is due to the installation of that new theme.

 

Why? There can be several reasons, for example, that this new WordPress template is poorly created and is generating some kind of problem in the query.

 

It is even possible that the theme is using some PHP function that is "limited" on the server for security reasons.

 

When this happens, we have a serious problem, since we cannot access the wp-admin of our WordPress to change the template for the old one.

 

What we have to do in this case is to access the files of our website via FTP and, in the WP-CONTENT / THEMES folder, look for the folder of our theme.

 

We copy the name of that theme folder and delete it.

 

After this, we can take any of the themes that come by default in WP and put the name that we have copied from the theme that gave failure.

 

2. When Installing A Plugin

 

Something also quite frequent is that the HTTP error 500 appears because of conflicts between plugins of your page or your own blog in WordPress.

 

Fixing it is easy, but sometimes it can take a while.

 

In many occasions, the plugins can have failures or even use restricted or incompatible functions with our server.

 

In order to solve this problem, we will have to deactivate the plugin, but if our website gives us an error 500 and we cannot enter the wp-admin, we will not be able to do so.

 

In this case, what we will do is access the files on our website via FTP and access the WP-CONTENT / PLUGINS directory and delete the folder from our plugin.

 

However, if the problem persists, perhaps it is that two or more of your plugins have begun to be incompatible with each other, which can sometimes happen with updates to them.

 

To solve this, it would be best if you deactivate all of them.

 

If you see that the problem disappears, it is that you have guessed the cause of the problem, but now you must activate the plugins one by one, to see which one was causing the problems.

 

Again, if we cannot access wp-admin, we will have to rename or delete the folders of the plugins, so that WordPress deactivates them.

 

3. Plugin That Modifies The Htaccess

Some plugins on our website in WP modify the .htaccess file without our being aware of it.

 

As I mentioned before, the .htaccess file can generate 500 errors, therefore, it is important to have a backup of the old .htaccess, or to generate a new .htaccess, to be able to check if this is the fault.

 

4. For Extreme Cases

For extreme cases in which we do not find out what the problem is, we can resort to reinstalling it again and thus check if the problem really comes from there or if it really is an external problem.

 

Download WordPress from the official website and upload the files via FTP, replacing the old files.

 

Remember that you must leave the old wp-config.php file, which is where the connection data to the database of your WP installation is, something essential for this to work.

 

If you have downloaded a newer version of WP, you must also access "tuweb.com/wp-admin/upgrade.php" via the browser, so that the part of the database corresponding to the new version is updated.

collect
0
avatar
Puneet Sharma
guide
Zupyak is the world’s largest content marketing community, with over 400 000 members and 3 million articles. Explore and get your content discovered.
Read more