Artisan Développeur

Qualité, amélioration continue, agilité, professionnalisme.

symfony, composer, clear:cache issue with vagrant and virtualbox

Quick tip today,

I have just finished to setup a new development environment with vagrant for my Symfony project, I have struggled with the clear:cache command, every time this command is failing.

Virtualbox seems to be the one to blame, below some relevant links:

The solution I have chosen is to change the directories of logs and cache:

    public function getCacheDir()
    {
        if (in_array($this->environment, ['dev', 'test'])) {
            return '/tmp/cache/' .  $this->environment;
        }

        return parent::getCacheDir();
    }

    public function getLogDir()
    {
        if (in_array($this->environment, ['dev', 'test'])) {
            return '/var/log/symfony/logs';
        }

        return parent::getLogDir();
    }

And all is fine with Symfony and vagrant after that, composer run, do is clear:cache, and nothing is broken anymore !

 

Leave a reply

Your email address will not be published.

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.