Reputation: 2734
So I get this famous error while try to run shell script (through browser is working without issues)
Fatal error: Uncaught CacheException: Cache engine "default" is not properly configured.
default is pointing to Apc
cache.
Cache::config('default', array(
'engine' => 'Apc',
'prefix' => 'some_default',
'duration' => '+1 hour'
));
Stack trace:
#0 /.../lib/Cake/Cache/Cache.php(151): Cache::_buildEngine('default')
#1 /.../app/Config/core.php(381): Cache::config('default', Array)
#2 /.../lib/Cake/Core/Configure.php(72): include('/home/...')
#3 /.../lib/Cake/bootstrap.php(432): Configure::bootstrap(true)
#4 /.../lib/Cake/Console/ShellDispatcher.php(145): require('/home/...')
#5 /.../lib/Cake/Console/ShellDispatcher.php(100): ShellDispatcher->_bootstrap()
#6 /.../lib/Cake/Console/ShellDispatcher.php(54): ShellDispatcher->_initEnvironment()
#7 /home/ in /.../lib/Cake/Cache/Cache.php on line 186
Environment:
Apache/2.4.18 (Ubuntu)
PHP 7.0.13-0ubuntu0.16.04.1 (cli)
CakePHP v2.8.0
php -i | grep apc:
apc.coredump_unmap => Off => Off
apc.enable_cli => On => On
apc.enabled => On => On
apc.entries_hint => 4096 => 4096
apc.gc_ttl => 3600 => 3600
apc.mmap_file_mask => no value => no value
apc.preload_path => no value => no value
apc.serializer => php => php
apc.shm_segments => 1 => 1
apc.shm_size => 32M => 32M
apc.slam_defense => On => On
apc.smart => 0 => 0
apc.ttl => 0 => 0
apc.use_request_time => On => On
apc.writable => /tmp => /tmp
Cake tmp
folder - permissions 777
owned by www-data
user (which run apache also)
tmp
contains /cache
, tmp/cache/models
, tmp/cache/persistent
and tmp/logs
with the same permission as tmp
.
If I change default engine from Apc
to Redis
for example, everything works without issues.
Upvotes: 0
Views: 835
Reputation: 2734
Apc
for php7.0
is deprecated, so you need install apcu
and than apcu-bc
- for compatibility with apc
.
Maybe is only in my case but when i put in .../cli/php.ini
those lines
extension=apcu.so
extension=apc.so
apcu.enabled=1
apc.enable_cli=1
Apc still not work, i got warnings:
default cache was unable to write 'key' to Apc cache
It start to work when i create two files
.../cli/config.d/apcu.ini
which contains:
extension=apcu.so
and .../cli/config.d/z_apc.ini
which contains:
extension=apc.so
apc.enable_cli=1
(z
prefix is for order, apc should be loaded after apcu)
Upvotes: 1