Reputation: 142
When using the file cache, this config let me write/read the cache from a shell script
Cache::config('default', array(
'engine' => 'File',
'mask' => 0666
));
However, when using something like this
Cache::config('default', array(
'engine' => 'Apc',
'mask' => 0666 // I don't think this is used by Apc cache.
));
I get permission errors when saving/reading the cache from a shell script. The Apc cache is working fine when running from regular page loads though. I understand that shell scripts aren't executed from the same user as regular page loads, but I don't know how to set the Apc cache permissions correctly.
Here's my shell script:
class HelloShell extends AppShell {
public function main(){
Cache::write('Hello', 5);
}
}
Here's the error
Warning Error: default cache was unable to write 'hello' to Apc cache in [/home/pi/MyProject/lib/Cake/Cache/Cache.php, line 325]
Upvotes: 1
Views: 804
Reputation: 96
You need to enable APC for php-cli http://www.php.net/manual/en/apc.configuration.php#ini.apc.enable-cli because shell jobs runs as command line php
Upvotes: 8
Reputation: 3889
Well, you just answered your question. Have you tried changing the permissions of the App/tmp/ directory to 777?
#chmod -R 777 app/tmp
Upvotes: 1