Changing cache_dir and log_dir with Symfony2

前端 未结 7 1998
感动是毒
感动是毒 2021-02-19 13:50

Because of deployment constraints, I would like to have the log and cache directories used by my Symfony2 application somewhere under /var/... in my file system. For this reason

7条回答
  •  死守一世寂寞
    2021-02-19 14:30

    In symfony you can override the cache (and logs) directory by extending the method in AppKernel.

    // app/appKernel.php
    class AppKernel extends Kernel
    {
        // ...
    
        public function getCacheDir()
        {
            return $this->rootDir.'/'.$this->environment.'/cache';
        }
    }
    

    Check out http://symfony.com/doc/current/cookbook/configuration/override_dir_structure.html#override-cache-dir

提交回复
热议问题