Have you ever wondered why the screen suddenly turns white while browsing your website, displaying a "HTTP 500 error"?
This is a problem that can occur from time to time, especially when you start updating your theme or modules from your PrestaShop online store..
But there is a simple solution, as you will see in today's article.
Once you have created your online store and set up everything you need to start selling your products or services, a HTTP 500 error (or internal server error) may appear. No need to panic!
However, we recommend that you take the time to resolve it, because if an error of this type persists over time, it can lead to serious losses for your company's website, since it prevents users from browsing your site and therefore, purchasing your products.
But first of all, what is this error?
What is a HTTP 500 error?
A server displays a HTTP 500 error (or internal server error) when it cannot process a request, a request that should be correct in principle.
Since each server can use its own texts and terminology, the error message can take many forms.
Here are some of the most common error messages:
- "Error 500 (Internal Server Error)"
- "Error 500 - Internal server error"
- "Internal server error"
- "HTTP ERROR 500"
- "Error 500"
- "HTTP Error 500"
Of course, such an anomaly can be rather worrying if you own an online store and this store is your main source of income.
And for web developers, it's a nightmare: a frantic race to get your site up and running again.
But how serious is a 500 error?
Although it sounds terrifying, encountering such a problem on your online store is not the end of the world.
In this article, we will explain how to fix it in your PrestaShop shop.
So next time, you will have nothing to worry about, and can act quickly to avoid delaying your sales any further!
How can I detect a HTTP 500 error in my PrestaShop shop?
In summary, this famous 500 error is the web server's way of saying "Oops! An error has occurred, but we can't tell you more."
This is known as a server-side problem.
In other words, a failure has occurred within the hosting service which hosts the website.
This is a very general warning, usually due to problems with PHP settings, programming or website permissions.
In most cases, this glitch is accompanied by a rather brief explanation, similar to this one:
The server reported an unexpected error and cannot complete the client' s request.
It is very important not to confuse it with the HTTP 404 error (page not found), that is also covered in this blog, and available to consult at any time.
Remember that this error can occur in any browser and operating system (so no, buying the new Apple Mac Pro will not prevent you from being confronted with it at some point...)
» Here is a screenshot with an example of how this error may be displayed:
How can I fix a HTTP 500 error on my online store website?
Although the error message is not very detailed, PrestaShop will give you more in-depth information about this problem.
Some servers, due to their configuration, often hide more specific error messages.
Therefore, if you have the same problem on your site and the error messages are too vague, you can activate your web host's FTP or CPanel error reports in your PrestaShop shop.
There are 2 ways to enable these reports, depending on the version you are using:
» From PrestaShop v1.4 to v1.5.2
- Open config/config.inc.php
- On line 29, you will find this line: @ini_set('display_errors','off');
- Replace it with: @ini_set('display_errors','on');
» PrestaShop v1.5.3 and later versions (including 1.6 and 1.7)
- Open config/defines.inc.php
- On line 28, you will find this line: define('_PS_MODE_DEV_', false);
- Replace it with: define('_PS_MODE_DEV_', true);
Once error reports from the FTP or CPanel are activated, you can browse your store's front or back office to find out what the problem is.
Also, if you cannot access your website due to error 500, you can enable the error report and refresh the page that failed to display. You will then be provided more information that will help you to understand the causes and location of this incident.
What can cause an error 500?
Now that you have more information, you can use some of the standard tips below to deepen your understanding.
To begin, review the most common causes of the problem. If we know the cause of the problem, it is much easier to find the right solution and act accordingly.
The problem may be related to the following causes:
1. Permission error
In many cases, you will find that folder permissions are not set correctly.
To correct this error, simply set a file or folder authorisation to 755 instead of 777 (or vice versa).
In general, 777 permissions are incredibly unprotected and even an amateur hacker can enter your files and add harmful malware.
Check the specific permissions features with your host, as some servers use different rules.
2. Incorrect configuration of the.htaccess file
Internal server problems are often caused by a poorly configured .htaccess file.
As far as PrestaShop is concerned, the problems are generally related to URL re-writing options and activating "friendly URLs".
A .htaccess file's format is very strict, and even an incorrect character or command could cause an internal 500 server error. Therefore, from the "friendly URLs" option, indicating "NO" could be a solution (don't forget to save your changes).
We recommend that you backup your.htaccess file and restore it from the back office, or disable friendly URLs.
3. Waiting time has expired
Each server has its own waiting time, which determines how long a script will run.
If the function or script exceeds this time limit, you will receive a 500 error.
Here are the PrestaShop scripts that may take too long to load:
- Importing CSV files.
- Backup files.
- Loading translations.
- Regenerating miniature views.
In most cases, the server time limit is 30 seconds, which is not enough for these scripts.
In this case, you should contact your host and ask them to change this setting (at least temporarily).
4. Obsolete modules
When updating your shop (for example: if you upgrade from version 1.6 to version 1.7), you may encounter obsolete modules or modules that are incompatible with this new version of PrestaShop.
This can generate 500 errors. In this case, we will need to review all the Addons you have previously installed, or at least those that are available in a more recent version.
We recommend that you always have the official PrestaShop Marketplace page ready (or saved in your favourites), where you can obtain official modules, which are always up-to-date.
What if this HTTP 500 error persists in my shop once I have completed these checks?
In this case, you should consult the Apache and PHP error logs.
While some of these may be provided by your host, you may need to contact them directly to access the files.
"There are other solutions available on our forum"
Even if it seems obvious at first glance, when you receive specific PrestaShop information concerning the error or log file, you may want to do a Google search (focus on the problem and add the word "PrestaShop" to your search).
You will then find various information and tutorials for the type of error that occurred.
You will also certainly find discussions on the PrestaShop forum, entitled "[RESOLVED]".
Go through it carefully and, if after reading this post, you still haven't been able to correct your error, be sure to register on the PrestaShop forums and ask for help.
With over a million members, you are sure to find answers to your questions, with the help of other users.
There are also official PrestaShop support plans.
These will allow you to contact us, and to obtain additional assistance from one of our representatives.
At the beginning of this article, we told you that a HTTP 500 error or internal server error is not as bad as it seems.
Now you have the right tools to correct one of the most dreaded errors amongst Internet users.
Start your online store with the PrestaShop online software, and continue selling your products or services with total peace of mind!