简体   繁体   English

PHP5.6和APC安装

[英]PHP5.6 and APC installation

How to install APC under PHP 5.6?如何在 PHP 5.6 下安装 APC?

APC is installed安装了 APC

apt-get install php-pear php5-dev make libpcre3-dev
pecl install apc

# locate apc.so
/usr/lib/php5/20100525/apc.so

APC is added to php.ini APC 被添加到 php.ini

extension=apc.so

But APC is not mentioned in output from phpinfo()但是phpinfo()输出中没有提到 APC

Fatal error: Call to undefined function apc_fetch()

APC is (more or less) a deprecated package (the last release, 3.1.14, was unstable and had to be rolled back). APC(或多或少)是一个不推荐使用的软件包(最后一个版本 3.1.14不稳定,必须回滚)。 It has been replaced by the core package opcache.它已被核心包 opcache 取代。

I'm not sure about Debian flavors (all my searches return the PECL library while opcache is native to 5.6) but in CentOS you have to install the php-opcache package, which contains the opcahce.so file.我不确定 Debian 的风格(我的所有搜索都返回 PECL 库,而 opcache 是 5.6 原生的)但在 CentOS 中,您必须安装php-opcache包,其中包含 opcahce.so 文件。

这个对我有用

yum install php56w-pecl-apcu

For Amazon Linux, The below command worked for me.对于 Amazon Linux,以下命令对我有用。

yum install php56-pecl-apcu yum 安装 php56-pecl-apcu

As mentioned by others on this question, on PHP 5.6, you probably don't want the full APC package.正如其他人在这个问题上提到的那样,在 PHP 5.6 上,您可能不想要完整的 APC 包。 Instead, you almost certainly just want the user-data caching portion, APCu.相反,您几乎可以肯定只想要用户数据缓存部分 APCu。

If you're using PECL, you need to specify the correct version of APCu to use which appears to be 4.0.11:如果您使用的是 PECL,则需要指定要使用的正确版本的 APCu,它似乎是 4.0.11:

pecl install apcu-4.0.11

(Worked for me on CentOS 6, EasyApache 3, Apache 2.2, PHP 5.6.39. 🎉) (在 CentOS 6、EasyApache 3、Apache 2.2、PHP 5.6.39 上为我工作。🎉)

On Ubuntu 18.04 simply running在 Ubuntu 18.04 上只需运行

sudo apt install php-apcu

and enabling it on /etc/php/5.6/apache2/php.ini by adding this lines at the end of the file:并通过在文件末尾添加以下行在/etc/php/5.6/apache2/php.ini上启用它:

extension=apcu.so
apc.enabled=1

(and restarting apache2 if necessary) (并在必要时重新启动 apache2)

sudo service apache2 restart

Worked for me.为我工作。

On Ubuntu 18.04 this worked for me:在 Ubuntu 18.04 上,这对我有用:

  1. Download rpm from here 从这里下载rpm

  2. install alien to able to install rpm安装外星人才能安装rpm

    sudo apt-get install alien
  1. install apcu安装apcu
    sudo alien -i ~/Downloads/php56-php-pecl-apcu-4.0.11-1.el7.remi.x86_64.rpm
  1. open apcu.ini打开apcu.ini
    sudo nano /etc/php/5.6/cli/conf.d/20-apcu.ini
  1. add these lines to enable apcu添加这些行以启用apcu
    extension=apcu.so
    apc.enabled=1
    apc.enable_cli=1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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