I installed CiviCRM 5.4.0 locally under both Apache and IIS 6 (PHP 7.0) and did not get this error, but the every time I try to installing it using shared hosting (Everleap - IIS 8, PHP 7.0) the install fails with:

Uncaught Symfony\Component\Filesystem\Exception\IOException: Cannot rename "C:\home\site\wwwroot\wp-content\uploads\civicrm\templates_c\Cac3AA.tmp" to "C:\home\site\wwwroot/wp-content/uploads\civicrm\templates_c/CachedCiviContainer.e5d039483e5b5fef124d645e968cad32.php"

Now, I can verify that the file exists (Cac3AA.tmp) in the templates_c folder, so I know the install process created that file (has write access to the folder). However, the rename fails. Anyone see that before?

  • Ok. I know what's happening, but I don't know why. In the uploads\civicrm\templates_c folder, cache files are written. However, it looks like they are written with one name and then renamed almost immediately to something ".php". The rename is failing. It's failing on the shared hosting and not on my local machine because the path name has doubled slashes - it's looking for templates_c\/Cached... instead of templates_c\Cached... Sep 8, 2018 at 11:20
  • I hacked line 272 of Symfony's Filesystem.php to read:if (true !== @rename(str_replace(array("\\\\", "\\/"), "\\", $origin), str_replace(array("\\\\", "\\/"), "\\", $target))) { to remove the extra slashes, and this part works (although now it's breaking in Smarty as well. Any one have any idea why having double slashes works on my local file system and not on the shared host. Sep 8, 2018 at 11:22

1 Answer 1


Problem resolved. The bug is in fact that the PHP rename function running on Windows Server can't handle a double slash (\\) in the path name. I made three changes (so far).

Symfony - Filesystem.php line 272
if (true !== @rename(str_replace(array("\\\\", "\\/"), "\\", $origin), str_replace(array("\\\\", "\\/"), "\\", $target))) {

Smarty.class.php line 1253
$_smarty_compile_path = str_replace(array("\\\\", "\\/"), "\\", $this->_get_compile_path($resource_name));

Smarty - core.write_file.php line 45
@rename(str_replace(array("\\\\", "\\/"), "\\", $_tmp_file), str_replace(array("\\\\", "\\/"), "\\", $params['filename']));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.