php 带有 APCu 的 PHP7 - 调用未定义的函数 apc_fetch()

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36129259/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 00:43:02  来源:igfitidea点击:

PHP7 with APCu - Call to undefined function apc_fetch()

php

提问by clarkk

I have installed APCu extension in PHP7

我已经在 PHP7 中安装了 APCu 扩展

But I get this error

但我收到这个错误

Call to undefined function apc_fetch()

enter image description here

在此处输入图片说明

回答by dani g

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.

从 PHP 7.0 开始,APCu 删除了 PHP 5.5 和 5.6 中 APCu 存在的与 APC 完全向后兼容的选项。

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)

您需要在 apcu 之上添加 APCu 向后兼容模块才能使其工作。( https://pecl.php.net/package/apcu_bc)

pecl install apcu_bc

回答by Stéphan Champagne

You need to install apcu and apcu backward compatibility for PHP7

需要为PHP7安装apcu和apcu向后兼容

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

在 Ubuntu 14.xx 上,您首先需要使用 repo 安装 php7.0:

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

然后重启apache

For ubuntu 16.xx. You can already install apcu

对于 ubuntu 16.xx。你已经可以安装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

回答by Andrew Zhilin

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

这样的安装对我不起作用 - ubuntu 没有 apcu-bc 包。

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

之后我将 /etc/php/7.0/mods-available/apcu-ini 更改为

extension=apcu.so
extension=apc.so

Note, that apc.so must be AFTER apcu

请注意,apc.so 必须在 apc 之后

回答by Oleg Liski

APC and APCu are different modules.

APC 和 APCu 是不同的模块。

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

您已经安装了 APCu,但是,您正在使用 APC 功能。

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

尝试 apcu_fetch 或安装 apc,如果 PHP7 可能的话。

回答by trank

In Centos using IUS repo, install apcuand apcu-bcpackages for php7:

在 Centos 中使用 IUS repo,为 php7安装apcuapcu-bc打包:

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