How to manage cache permissions in Symfony2

  • Alain Horner

I guess in the Symfony2 world, we all know the following problem: We have a running Symfony2 installation we already accessed in the browser. Now we want to use the Symfony2 console to run a command and BANG we get an exception. The problem is, that the cache directory is not writable by the command line user. Now the usual reaction is “let's just set the access rights to 777”, which solves the problem for the moment. But of course it will return, once the command line user wants to access another file/directory that was created by the webserver.

Luckily there is a more sustainable solution, which is described here.

I hope this will save you some time – it for sure saved me some :)

Tell us what you think