php-docs-samples icon indicating copy to clipboard operation
php-docs-samples copied to clipboard

Unable to set cache path on appengine.

Open washington-kibichii opened this issue 5 years ago • 2 comments

Since all Directories are read only, I am unable to set a cache path on app engine. I have tried to overide the config by using database as the drive but no success, could anyone assist please InvalidArgumentException

Please provide a valid cache path.

 

washington-kibichii avatar Feb 18 '20 23:02 washington-kibichii

The cache path can be set to /tmp, which is writeable and ephemeral (it will be destroyed once the instance shuts down).

Which sample are you running?

bshaffer avatar Feb 25 '20 21:02 bshaffer

If you're running Symfony, put the following in your Kernel class in src/Kernel.php:

    public function getCacheDir()
    {
        if ($this->environment === 'prod') {
            return sys_get_temp_dir();
        }
        return parent::getCacheDir();
    }

    public function getLogDir()
    {
        if ($this->environment === 'prod') {
            return sys_get_temp_dir();
        }
        return parent::getLogDir();
    }

bshaffer avatar Mar 02 '20 21:03 bshaffer