18
votes

I have installed APCu extension in PHP7

But I get this error

Call to undefined function apc_fetch()

enter image description here

5

5 Answers

26
votes

Starting with PHP 7.0, APCu removed the option for full backwards compatibility with APC that existed with APCu in PHP 5.5 and 5.6.

You will need to add the APCu Backwards Compatiblity Module on top of apcu to make it work. (https://pecl.php.net/package/apcu_bc)

pecl install apcu_bc
18
votes

You need to install apcu and apcu backward compatibility for PHP7

On Ubuntu 14.xx you first need to install php7.0 by using the repo:

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.0

Then

sudo apt-get install php7.0-apcu
sudo apt-get install php7.0-apcu-bc

Then restart apache

For ubuntu 16.xx. You can already install apcu

sudo apt-get install php-apcu

Then add the repo:

sudo add-apt-repository "deb http://ftp.de.debian.org/debian sid main"
sudo apt-get update

then

sudo apt-get install php-apcu-bc
5
votes

Such an installation doesnt work for me - ubuntu doesnt have apcu-bc package.

apt-get install php7.0-apcu-bc

My installation

sudo apt-get install php-dev
sudo pecl install apcu_bc-beta

After that I changed /etc/php/7.0/mods-available/apcu-ini to

extension=apcu.so
extension=apc.so

Note, that apc.so must be AFTER apcu

1
votes

APC and APCu are different modules.

You have APCu installed, however, you are using APC functions.

Try apcu_fetch or install apc, if that is possible for PHP7.

0
votes

In Centos using IUS repo, install apcu and apcu-bc packages for php7:

sudo yum install php71u-pecl-apcu php71u-pecl-apcu-bc