cakephpcachingcakephp-2.0cakephp-2.4

After setting cache mask at 777, the permissions generated on the cache file is read only


I am using php5.3.10 on ubuntu 12.04 LTS.

I am running CakePHP 2.4.2.

This is my bootstrap.php

// Setup a 'default' cache configuration for use in the application.
Cache::config('default', array(
    'engine' => 'File',
    'mask' => '0777'
));

THis is my cache folder

enter image description here

As you can see, the cache file generated is NOT 777.

I am not sure what else to do. I have restarted the server.

I have ensured that the tmp folder is 777.

Please advise.


Solution

  • The answer is lose the single quotes for the mask option.

    // Setup a 'default' cache configuration for use in the application.
    Cache::config('default', array(
        'engine' => 'File',
        'mask' => 0777 // no single quotes!!!!
    ));
    

    To anyone who doesn't believe me, please look at the source code for the template skel that generates the core.php for 2.x

    https://github.com/cakephp/cakephp/blob/2.x/lib/Cake/Console/Templates/skel/Config/core.php#L273

    'mask' => 0664, //[optional]

    As you can see, there's no quotation marks. This is what works for me.