error internal write file

965 views
Skip to first unread message

aurelien gerits

unread,
Feb 1, 2012, 5:22:26 AM2/1/12
to smarty-d...@googlegroups.com
Hello, I have a problem with writing to files compiled.
I receive from time to time an error message but only if I change configuration files or parent file.


Fatal error: Uncaught exception 'SmartyException' with message 'unable to write file C:/wamp/www/myproject/temp/templates_c\bfbe8b3190992b164c014dd83e725636ef061c84.movie_fr.conf.config.php' in C:\wamp\www\myproject\library\smarty3\sysplugins\smarty_internal_write_file.php on line 55

Best regards

uwe.tews

unread,
Feb 1, 2012, 2:56:00 PM2/1/12
to Smarty Developers
Which operating system are you running on your server? Which version
of Smarty?

You may try to update to the SVN trunk version of Smarty because
entropy of the temporary filenames has been extended in that version.

Regards Uwe



On Feb 1, 11:22 am, aurelien gerits <gerits.aurel...@gmail.com> wrote:
> Hello, I have a problem with writing to files compiled.
> I receive from time to time an error message but only if I change configuration
> files or parent file.
>
> *Fatal error: Uncaught exception 'SmartyException' with message 'unable to
> write file
> C:/wamp/www/myproject/temp/templates_c\bfbe8b3190992b164c014dd83e725636ef061c84.movie_fr.conf.config.php'
> in
> C:\wamp\www\myproject\library\smarty3\sysplugins\smarty_internal_write_file.php
> on line 55*
>
> Best regards

aurelien gerits

unread,
Feb 1, 2012, 3:23:39 PM2/1/12
to smarty-d...@googlegroups.com
On my server using vmware, I use windows + wamp seven
Permissions can be associated with the virtual machine?
I already use the SVN version:)
Best regards

2012/2/1 uwe.tews <uwe....@googlemail.com>

--
You received this message because you are subscribed to the Google Groups "Smarty Developers" group.
To post to this group, send email to smarty-d...@googlegroups.com.
To unsubscribe from this group, send email to smarty-develop...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/smarty-developers?hl=en.


uwe.tews

unread,
Feb 2, 2012, 10:59:08 AM2/2/12
to Smarty Developers
This error occurs if the rename in line 52 of
smarty_internal_write_file.php does fail.

rename does fail in some Windows versions when the target file is
existing, For that reasion Smarty does unlink the target file before
the rename.

Smarty does lock possible concurrent compilation of same template file
so that I do not expect a race condition for the unlock / rename
squence.
But for a test you could replace line 52 and 53 with

if (!(@rename($_tmp_file, $_filepath) || (@copy($_tmp_file,
$_filepath) && unlink($_tmp_file)))) {

Uwe

On Feb 1, 9:23 pm, aurelien gerits <gerits.aurel...@gmail.com> wrote:
> On my server using vmware, I use windows + wamp seven
> Permissions can be associated with the virtual machine?
> I already use the SVN version:)
> Best regards
>
> 2012/2/1 uwe.tews <uwe.t...@googlemail.com>

aurelien gerits

unread,
Feb 3, 2012, 4:05:36 AM2/3/12
to smarty-d...@googlegroups.com

Hello, I try but the problem persists

Is this related to vmware? may be the permissions windows seven

Best regards


2012/2/2 uwe.tews <uwe....@googlemail.com>
330.gif

Rodney Rehm

unread,
Feb 3, 2012, 4:36:09 AM2/3/12
to smarty-d...@googlegroups.com
Sounds as if the unlink() failed [because of permissions]. create a test.php with the following content:
<?php
$file = "/some/path/to/write-to.txt";
file_put_contents($file, "test");
unlink($file);
if (file_exists($file)) {
  echo "file not deleted";
} else {
  echo "should be ok";
}
?>

and make sure the script is run in the same environment as smarty is.
Reply all
Reply to author
Forward
0 new messages