Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP7 with APCu - Call to undefined function apc_fetch()

Tags:

php

I have installed APCu extension in PHP7

But I get this error

Call to undefined function apc_fetch()

enter image description here

like image 546
clarkk Avatar asked Mar 21 '16 11:03

clarkk


4 Answers

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
like image 150
dani g Avatar answered Nov 12 '22 04:11

dani g


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
like image 41
Stéphan Champagne Avatar answered Nov 12 '22 04:11

Stéphan Champagne


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

like image 6
Andrew Zhilin Avatar answered Nov 12 '22 05:11

Andrew Zhilin


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.

like image 1
Oleg Liski Avatar answered Nov 12 '22 04:11

Oleg Liski