0
votes

This is the error

RuntimeException: Unable to create the cache directory (1/25/20).

1- Changing the cache directory in the appKernel file didn't fix the problem

/*
        public function getCacheDir()
        {
            return '/mnt/symfony_ram_cache/cache/'.$this->environment;
        }
*/

2- Setting the permissions to "chmod 777 -R cache" didn't work, still throws the error

3- App works when I deactivate the twig cache (I obviously need it in production)

#Twig Configuration
twig:
   cache: false

4- It DOES create several folders in cache (in both prod and dev) when I empty the cache directoy and reload, so what means the rights are actually set properly

screenshot

5- Here is a screenshot of the error

error screenshot

6- PS: Updated to symfony 2.5.6 the twig bundle was updated but still have no luck

3
Don't clear cache directory itself, To clear cache just remove directories/files inside that. - Apul Gupta
@ApulGupta That's what I meant by clearing it, I'll edit the post to avoid further confusion - user3531149

3 Answers

0
votes

Maybe you should chown cache directory to user who fires up application (www-data?)?

0
votes

Edit your

app/config/config.yml

And change this:

From:

twig:
     cache:            "%kernel.debug%"

To:

twig:
     cache:            "%kernel.cache_dir%/twig"
0
votes

I don't know what was wrong, I installed symfony2 from scratch again and now it works.