Ocasional error warning when CakePHP is writing to the cache

前端 未结 4 1316
野的像风
野的像风 2021-01-05 12:42

I\'m developing a CakePHP 2.2 site locally with MAMP. Every so often, I get one or more warnings similar to this, about not being able to write to one or more cache files:

4条回答
  •  情话喂你
    2021-01-05 13:06

    Just in case anybody is seeing this and wonders how it works in cakePHP 3.x:

    modify /config/app.php and add 'mask' => 0666 to

    /**
     * Configure the cache adapters.
     */
    'Cache' => [
        'default' => [
            'className' => 'File',
            'path' => CACHE,
            'url' => env('CACHE_DEFAULT_URL', null),
            'mask' => 0666
        ],
    

    and probably you also want to add it to the log files:

    /**
     * Configures logging options
     */
    'Log' => [
        'debug' => [
            'className' => 'Cake\Log\Engine\FileLog',
            'path' => LOGS,
            'file' => 'debug',
            'levels' => ['notice', 'info', 'debug'],
            'url' => env('LOG_DEBUG_URL', null),
            'mask' => 0666
        ],
        'error' => [
            'className' => 'Cake\Log\Engine\FileLog',
            'path' => LOGS,
            'file' => 'error',
            'levels' => ['warning', 'error', 'critical', 'alert', 'emergency'],
            'url' => env('LOG_ERROR_URL', null),
            'mask' => 0666
        ],
    ],
    

提交回复
热议问题