php PHP5.6和APC安装
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26818656/
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
PHP5.6 and APC installation
提问by clarkk
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()
但是在输出中没有提到 APC phpinfo()
Fatal error: Call to undefined function apc_fetch()
回答by Machavity
APC is (more or less) a deprecated package (the last release, 3.1.14, was unstableand had to be rolled back). It has been replaced by the core package opcache.
APC(或多或少)是一个不推荐使用的软件包(最后一个版本 3.1.14不稳定,必须回滚)。它已被核心包 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 文件的软件包。
回答by Rjazhenka
It works for me
这个对我有用
yum install php56w-pecl-apcu
回答by Arul Deepan
For Amazon Linux, The below command worked for me.
对于 Amazon Linux,以下命令对我有用。
yum install php56-pecl-apcu
yum 安装 php56-pecl-apcu
回答by rinogo
As mentioned by others on this question, on PHP 5.6, you probably don't want the full APC package. Instead, you almost certainly just want the user-data caching portion, APCu.
正如其他人在这个问题上提到的那样,在 PHP 5.6 上,您可能不想要完整的 APC 包。相反,您几乎可以肯定只想要用户数据缓存部分 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 上为我工作。)
回答by Pavel Alazankin
On Ubuntu 18.04 this worked for me:
在 Ubuntu 18.04 上,这对我有用:
Download rpm from here
install alien to able to install rpm
sudo apt-get install alien
- install apcu
- 安装apcu
sudo alien -i ~/Downloads/php56-php-pecl-apcu-4.0.11-1.el7.remi.x86_64.rpm
- open apcu.ini
- 打开apcu.ini
sudo nano /etc/php/5.6/cli/conf.d/20-apcu.ini
- add these lines to enable apcu
- 添加这些行以启用apcu
extension=apcu.so
apc.enabled=1
apc.enable_cli=1
回答by Raül Ojeda
On Ubuntu 18.04 simply running
在 Ubuntu 18.04 上只需运行
sudo apt install php-apcu
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
sudo service apache2 restart
Worked for me.
为我工作。