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 will talk about a critical error that many are bringing to you headon and that although the solution is simple, it is very difficult to find it if you do not have advanced knowledge in 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 an error 500 or the page goes blank. That’s why we call it a critical mistake, for leaving the store inoperative.
The most important feature of this problem is that curiously the error only occurs when one of the two available modes is activated (Failsafe Mode or DEBUG Mode and Normal Mode) and not in both modes interchangeably.
But before we go into the matter with the explanation, let’s make a point 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 source 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-digit (1xx, 2xx, 3xx, 4xx, 5xx). Some (not all) of these codes mean an error or conflict state.
In the case of 5xx errors, its source 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 task to return information by the server to the web browser will stop. Therefore, as we mentioned above, this is a critical error that would leave the website inoperative.
The 500 errors, as we noted above, are internal server errors and their origin may be in a programming code error on any item 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 do I know the source of 500 errors?
Being an internal server error, the safest way to know where the error came from 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 is located within a folder called logs usually located in the /var/www/vhosts/”yourdomain”/logs path (“yourdomain” would be the domain being used on the server).
How to detect this 500 error
Going back to the subject, we will explain the origin of this characteristic error 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 “prod” (production mode) and “dev” (Debug mode) folders, depending on the Prestashop mode being used.
These cache files serve to speed up 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:
If a programming code error exists, it will be written to the cache files corresponding to the mode that is currently being used. For example, if Debug mode is being used, the cache files with the error will be saved in the “dev” folder, and so that only when Debug mode is enabled will that server error 500 be caused and will not be originated when production mode is activated (normal mode).
How to fix this problem
The solution, as we used at the beginning of this post, is relatively simple. Once the source of the problem is known, basically the solution is to clean and delete all Prestashop cache files that contain the two folders we mentioned earlier, “dev” and “prod”.
Important: To your knowledge, this type of cache files is not automatically deleted from the “Empty cache” option we have in the Back-office in advanced > performance parameters so cleaning and removing has to be done manually or through some module or script developed for this function.
In Liewebs we have developed a script that when executed has the function to completely clean up the entire Prestashop cache, including the cache files of these two folders. You can download it for free by clicking on the following button: