问题
I receive the exception when configure the cache components in main configuration of advanced-template frontend, on my php.ini the extension rsults enabled, how I can fix this problem? frontend/config/main.php:
'cache' => [
'class' => 'yii\caching\ApcCache',
'keyPrefix' => 'myapp', // a unique cache key prefix
],
The phpinfo()
about apcu:
回答1:
Solved by updating the configuration as follow:
'cache' => [
'class' => 'yii\caching\ApcCache',
'keyPrefix' => 'myapp', // a unique cache key prefix
'useApcu' => true,
],
The php version is the 7.0.18 and, as I can learn, this version use only apcu and not the apc like php 5.X
回答2:
APC and APCu are diffrent extensions. To make it work, you have to install APC
, in linux:
sudo apt-get install php-apc
sudo /etc/init.d/apache2 restart
回答3:
This fix worked for me. The only fix that worked is to explicitly change
public $useApcu = false;
in the ApcCache class to
public $useApcu = true;
来源:https://stackoverflow.com/questions/45460796/yii2-exception-apccache-requires-php-apc-extension-to-be-loaded