Jump to content

Again on "Smarty unable to write file..."


am79

Recommended Posts

...try to clarify once for all?

 

ok,

in php error log we may have something like this:

[29-Nov-2016 18:25:49 Europe/Rome] PHP Fatal error:  Uncaught  --> Smarty: unable to write file /home/myuser/public_html/myfolder/cache/smarty/cache/productscategory/1251/315/0/1/1/3/1/10/c1/a0/1d/wrt583dba1d624b19_41638485 <-- 
  thrown in /home/myuser/public_html/myfolder/tools/smarty/sysplugins/smarty_internal_write_file.php on line 46
smarty_internal_write_file.php on line 46

 

 

 

 

$_tmp_file = $_dirpath . DS . str_replace(array('.', ','), '_', uniqid('wrt', true));
        if (!file_put_contents($_tmp_file, $_contents)) {
            error_reporting($_error_reporting);
            throw new SmartyException("unable to write file {$_tmp_file}");
        }

        /*
         * Windows' rename() fails if the destination exists,
         * Linux' rename() properly handles the overwrite.
         * Simply unlink()ing a file might cause other processes
         * currently reading that file to fail, but linux' rename()
         * seems to be smart enough to handle that for us.
         */
        if (Smarty::$_IS_WINDOWS) {
            // remove original file
            @unlink($_filepath);
            // rename tmp file
            $success = @rename($_tmp_file, $_filepath);
        } else {
            // rename tmp file
            $success = @rename($_tmp_file, $_filepath);
            if (!$success) {
                // remove original file
                @unlink($_filepath);
                // rename tmp file
                $success = @rename($_tmp_file, $_filepath);
            }
as you can see... it doesn't write the $_tmp_file (?)

 

BUT if I go into that specific path as domain owner, I CAN WRITE ANY FILE and I also find the renamed file which Prestashop uses...indeed there are no design or other errors on front office

and then, it even renames that file...

 

HOW is able to rename the file if at first is unable to write?

 

<_<  :D This is really odd and I don't know why these stupid errors which unnecessarily fill the log...

 

anyone who knows how to explain this ? Where's the real error?

thanks

Edited by am79 (see edit history)
Link to comment
Share on other sites

maybe I found...

not always it writes the file, sometimes it really fails...even if you set 777 permissions to cache/smarty/cache and compile and subdirectories...

I think the problem is here:
 

[root@myhost cache]# find . -mindepth 1 -type d | wc -l
19802

here is on smarty/cache

 

that means that 19802 directories are inside the cache...

 

I don't know if is hitting a limit but probably...

anyway I don't think that presta devs can ignore this caching method...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...