Prestashop – Fix [Fatal error: Uncaught –>Smarty: unable to write file] smarty_internal_write_file.php on line 46


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

Fatal error: Uncaught --> Smarty: unable to write file - /tools/smarty/sysplugins/smarty_internal_write_file.php on line 46

When this situation occurs, the Back-Office and Front-Office screen goes blank. Only by activating Prestashop’s Debug mode will you see the above message. For the duration of this error 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 go to line 46, we can see the following code:

throw new SmartyException("unable to write file {$_tmp_file}");

For those who know programming language, they can see that this is a function. It writes a file with a series of data for the cache. And for those who do not understand programming language, if they are fixed in the name of the function:

public static function writeFile ($_filepath, $_contents, Smarty $smarty)

You can infer this by simply reading the name of the function that is called writeFile.

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

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


Case 1 – Solution

This permissions issue occurs on some servers that do not default to assign 755 permissions to folders and files. And for that reason, to fix this you must apply the 755 permissions to the directory, subdirectories and files of the following path:


In case you cannot do it by yourself through the hosting panel or via FTP, then a support ticket must be sent to the Hosting provider for them to do it for you. In this way, ask them to apply those permissions to the specified folder. In case you can do it yourself.


Case 2 – Solution

If the permissions assigned to the cache folder are correct, then all that remains is 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 you do not have enough disk capacity to do so.

You may see that some memory is still available on your Hosting server. Still, it can happen that the system fails to write the cache files because the file size is larger than the available memory on the server’s hard drive.

To fix this, please contact the contracted Hosting provider. Ask for a hard drive size extension. Please note 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 recommended, depending on the size of the store and the contents of the store.

We hope to have helped you in resolving this very frequent error in Prestashop and that they leave the affected stores totally inoperative.

Do you want to avoid having this problem again because you have exceeded the quota limit in your Hosting plan?. You can hire our high performance AND optimized DEDICTEd Hosting services for Prestashop.

We have several high performance DEDICATED Hosting plans fully optimized for Prestashop. You won’t have any server optimization issues, or errors due to exceeding the disk quota limit. You’ll also experience an increase in web performance and upload speed. All this at a very competitive price!


Hire your Hosting plan

Artículos relacionados