[Prestashop error] – Smarty: Unable to write file smarty_internal_write_file.php on line 46

Published On: 8 de March de 2019Categories: PrestashopDaily Views: 1Total Views: 4293.6 min read


In this Post we are going to explain the causes of this error and how it should be solved. Specifically, this is an error related to writing Prestashop cache files. In addition, when it originates, it launches the following message:

Copy to Clipboard

When this situation occurs, the Back-office and Front-office screens go blank. Only by activating the Debug mode of Prestashop will you be able to see the previous message. While this error lasts, it will be impossible to operate in the Back-office and Front-office of the store. Therefore, your Prestashop store would be inoperative.

What are the causes of this error?

If we pay attention to the error message, we open the file located in /tools/smarty/sysplugins/smarty_internal_write_file.php and we go to line 46, we can see the following code:

Copy to Clipboard

For those who know programming language, you can see that it is a function. This is responsible for writing a file with a series of data for the cache. And for those who do not understand programming language, if you look at the name of the function:

Copy to Clipboard

They can deduce it just by reading the name of the function that is called writeFile .

This error can occur for one of the following two reasons:

  1. Permissions problem on the / folder cache / smarty / compile /
  2. Lack of disk quota space on the server.

Case 1 – Solution

This permission problem occurs on some servers that do not default to assigning 755 permissions to folders and files. And for that reason, to solve it, the permissions 755 must be applied to the directory, subdirectories and files of the following path:

/ cache / smarty / compile /

In case you cannot do it yourself through the hosting panel or via FTP, then you must send a support ticket to the Hosting provider so that they can do it for you. In this way, ask them to apply these permissions to the indicated folder. In case you can do it yourself.

Case 2 – Solution

If the permissions assigned to the cache folder are correct, then it remains only to think that the disk quota size of the server is insufficient. Therefore, because of this problem, it is not possible to write cache files because there is not enough disk capacity to do so.

You may see that your Hosting server still has some available memory. Even so, it may happen that the system cannot write the cache files because the size of the files is greater than that of the available memory on the server’s hard disk.

To solve it, you have to contact the contracted Hosting provider. Ask for a hard drive size upgrade. Keep in mind that the ideal hard drive capacity to install an online store under the Prestashop platform must be at least 5Gb. Sizes from 15GB to 30GB are more recommended, depending on the size of the store and its content.

We hope we have helped you in solving this very frequent error in Prestashop that leaves the affected stores completely inoperative.

Do you want to change your web hosting provider or hire a fully optimized server for Prestashop stores?

If you do not want this problem that we discussed in the article to happen again, then you have to hire one of our web hosting plans. We have high-performance servers, 100% optimized for use with Prestashop online stores. You will have ample disk space and freedom to configure the server adapting it to your needs.

Web hosting plans