Overriding the location for cache and logs in Symfony

A while ago I decided to move the projects I am working on to Dropbox. There are several reasons, but the main one is that in this way I could easily work on them using different computers with similar setup. I even setup up git and everything works fine. Most of these projects are in PHP using Symfony. However, one of the annoying things with this setting is that Dropbox had to synchronise continuously the logs and cache. Once, I even run out of space when the log grew too big. The documentation for Symfony explains how to override the default directories, but I wanted to do it only for the development environment. The solution is quite simple: change the settings only for the development environment.

If you want to use this code all you have to do is to specify your path on lines 17 and 30.

Leave a Reply