The error occurs when the Back-office is accessed only from Debug mode activated or in production mode activated. The characteristic of this error is that it only occurs in one of the modes and not in both.
In this article we are going to talk about a critical error That is leading many of you in your head and that despite the fact that the solution is simple, it is very difficult to find it if you do not have advanced knowledge of the inner workings of Prestashop.
This is an error that is occurring ONLY IN PRESTASHOP STORES VERSION 1.7 , and that makes it impossible for us to enter the Back-office, showing a 500 error or page is blank. For that reason we call it a critical error, for rendering the store inoperative.
The most important characteristic of this problem is that, curiously, the error only occurs when one of the two available modes is activated (Safe mode or DEBUG mode and normal mode) and not in both modes interchangeably.
But before going into the matter with the explanation, we are going to make a paragraph and explain what the 500 errors mean.
What is a 500 error?
All computer-related errors have an error code that serves to differentiate the origin of the problem and thus know how to find the solution efficiently and quickly. In this case, in everything related to web servers, there are several HTTP status codes three digits (1xx, 2xx, 3xx, 4xx, 5xx). Some of these codes (not all) signify an error or conflict state.
In the case of 5xx errors, their origin is related to the server and a problem in the programming code of its elements . Error 500 means Internal server Error . Whenever a 500 error occurs, the execution of the feedback task from the server to the web browser will be stopped. Therefore, as mentioned above, this is a critical error that would render the website inoperable.
The 500 errors, as we have indicated previously, are internal errors of the server and their origin can be in a programming code error in any element that is included and related to the request for information returned by the server to the web browser. Therefore, not all 500 errors come from the same source.
How can I find out the origin of the 500 errors?
As it is an internal server error, the safest way to find out the source of the error and the programming code elements that are causing the problem is through the server error log files. On Linux-based servers, the file is called error_log and it’s located inside a folder called logs generally located on the route / var / www / vhosts / ”yourdomain” / logs (“Yourdomain” would be the domain that is being used on the server).
How to detect this 500 error
Returning to the matter, we are going to explain the origin of this error so characteristic in Prestashop 1.7 stores and that curiously only happens when we have one of the two modes is activated and not with both.
In Prestashop 1.7 stores, unlike version 1.6, a series of cache files are created located in two folders “prod” (production mode) and “dev” (Debug mode), depending on the Prestashop mode that is being used.
These cache files are used to accelerate the operation of Prestashop in each of the chosen modes and are located in one of the two directories depending on the version of Prestashop:
- / app / cache /
- / var / cache /
If there is a programming code error, it will be written in the cache files corresponding to the mode that is being used at that moment. For example, if Debug mode is being used, the cache files with the error will be saved in the “dev” folder, and therefore only when Debug mode is activated will this server error 500 be generated and it will not be originated when the production mode (normal mode) is activated.
How to fix this problem
The solution, as we anticipated at the beginning of this post, is relatively simple. Once the origin of the problem is known, basically the solution is to clean and delete all the Prestashop cache files that contain the two folders that we have mentioned before, “dev” and “prod”.
This problem has already been dealt with in the Prestashop forum in Spanish and the Prestashop forum in English
IMPORTANT: For your knowledge, this type of cache files is not automatically deleted from the “Empty cache” option that we have in the Back-office at advanced parameters> performance therefore, the cleaning and elimination must be done manually or through a module or script developed for this function.
At Liewebs we have developed a script that when it is executed it has the function of completely clearing the entire Prestashop cache, including the cache files of these two folders.