Answers.Body: <p>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).</p>
  
  <p>Symfony - Filesystem.php line 272<br>
          <code>if (true !== @rename(str_replace(array("\\\\", "\\/"), "\\", $origin), str_replace(array("\\\\", "\\/"), "\\", $target))) {</code>  </p>
  
  <p>Smarty.class.php line 1253<br>
         <code>$_smarty_compile_path = str_replace(array("\\\\", "\\/"), "\\", $this-&gt;_get_compile_path($resource_name));</code>  </p>
  
  <p>Smarty - core.write_file.php line 45<br>
          <code>@rename(str_replace(array("\\\\", "\\/"), "\\", $_tmp_file), str_replace(array("\\\\", "\\/"), "\\", $params['filename']));</code></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-08T18:21:01.617Z
Answers.LastActivityDate: 2018-09-08T18:21:01.617Z
Answers.UserDisplayName: frankfazzio
Body: <p>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:</p>
  
  <p>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"</p>
  
  <p>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?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-09-08T11:20:39.850Z
Comments.Text: 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...
Comments.UserDisplayName: frankfazzio
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-09-08T11:22:43.673Z
Comments.Text: 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.
Comments.UserDisplayName: frankfazzio
Tags: <wordpress><symfony>
Title: New Install Civi 5.4.0 getting Uncaught Symfony Rename Error and Blank Screen
ThreadText: # New Install Civi 5.4.0 getting Uncaught Symfony Rename Error and Blank Screen
  
  (Asked by: username_0 on 2018-09-07)
  
  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?
  
  **Tags:** wordpress, symfony
  
  > **Comments:**
  > **username_0**: 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...  
  > **username_0**: 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.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-09-08. Score: 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']));`
  
  
  ---
  
  