简体   繁体   中英

Symfony / PHP7 APC -> APCu

I have issue with PHP7 and APCu. After installation I got this error:

Fatal error: Call to undefined function Doctrine\\Common\\Cache\\apc_fetch()

APCu is 100% enabled, I see it in the phpinfo(); And when I try apcu_fetch() it works.

How to use APCu in Symfony 2.8?

你可以更新Doctrine,至少它的doctrine / cache依赖(> = 1.6APCu现在支持:-)

This answer is obsolet. The correct answer is the one from François Breton.

In PHP 7 you have to add an additional module to your PHP setup: apc.so This is a module that enables backward compability to apc for apcu. This is kind of confusing...

See http://php.net/manual/de/apcu.installation.php for more info.

If you are using packages from https://deb.sury.org/ (ondrej ppa), you can install it via apt-get install php-apcu-bc .

If you use ubuntu:

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php-apcu-bc

On MacOS, using pecl is a one-command solution (after a brew install php@7.1 ) :

pecl install apcu

downloading apcu-5.1.17.tgz ...
[...]
Installing '/usr/local/Cellar/php@7.1/7.1.27/pecl/20160303/apcu.so'
install ok: channel://pecl.php.net/apcu-5.1.17
Extension apcu enabled in php.ini

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM