I had the problem, that symfony had no write permissons to create the cache files in the Windows Azure approot folder.
After some research I found out, that it is possible to allocate local storage where the role user has write permissions. The disadvantage though is, that the local storage is not persistent, that means, it will be reset after role upgrades, instance reimage or reboots. But for caching I don’t need a persistent storage.
To get it running you need the folowing settings:
Define a local resource, in this case with the folder name “FileCacheStorage” and the size 1000MB:
<?xml version="1.0" encoding="UTF-8"?>
<ServiceDefinition name="MyWebRole" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
<WebRole enableNativeCodeExecution="true" name="WebRole" vmsize="ExtraSmall">
<LocalStorage name="FileCacheStorage" sizeInMB="1000" />
Change the default symfony cache path within the “setup()” method:
$azureFileCachePath = substr($_SERVER['TEMP'], 0, 3).'Resources\Directory\\'.$_SERVER['RoleDeploymentID'].'.WebRole.FileCacheStorage\\cache';
$azureFileLogPath = substr($_SERVER['TEMP'], 0, 3).'Resources\Directory\\'.$_SERVER['RoleDeploymentID'].'.WebRole.FileLogStorage\\log';
// Replace default path with local azure storage path, defined in ServiceDefinition ("LocalStorage" = "FileCacheStorage"):
Notice: When you are testing in your local dev environment the local storage path is completely different (more information here), so I decided to change the path only in the cloud env, because locally I have no write problems. To get the recent drive letter I take it from $_SERVER['TEMP'].
(For the symonfy logging I did it the same way.)
Special thanks to Taylor for his hints.
I hope this helps somebody