Search code examples
cachingsymfonyproduction-environment

Symfony2 - A proper way to manage cache in production


I have seen several posts about production cache management but I'm trying to get the proper way.

I have seen some pretty sudo chmod 777 app/cache app/log and even sudo chmod 777 ../my_project_root :)

I don't want to use the chmod technique. I think it's better to chown www-data cache and log folders.

Now the question is:
When I need to clear the cache in my production server it's told to use:

$ sudo php app/console cache:clear --env=prod

But it seems to chown the prod cache folder back to root.

How should I properly clear the cache of my production server ?


Solution

  • sudo -u www-data php app/console cache:clear --env=prod