Installing APC op-code cache on Ubuntu 10.04

61 篇文章 0 订阅

http://blog.thecodingmachine.com/content/installing-apc-op-code-cache-ubuntu-1004



In this article, I will explain how to install the APC opcode cache in a few easy steps, on Ubuntu 10.04.
APC is an opcode cache (and more). When a PHP script is run, it is compiled by PHP internally, before executing it. PHP does not store the compiled result, therefore, next time the script is run, PHP will compile it again. APC is designed to store the result in its cache. This way, when PHP executes again a script, APC will serve the compiled script from the cache. PHP won't have to parse the script again, and it will save a lot of time.

First step: install PECL

apt-get install apache2-threaded-dev php5-dev php-pear make

Second step: install APC

pecl install apc

APC will ask this question:
Use apxs to set compile flags (if using APC with Apache)? [yes] :

Just answer: yes

PECL will compile the APC extension and generate a apc.so extension file. We need to be sure PHP knows about this file.

Note: if the build fails with this message:
/tmp/pear/temp/APC/php_apc.c:959: error: duplicate ‘static’
make: *** [php_apc.lo] Erreur 1
ERROR: `make' failed

then you might have to retry with a newer version of APC (as of July 2010, the latest stable version of APC does not completely support PHP 5.3 it seems).
Try this instead:
pecl install apc-beta

Third step: enable the extension

cd /etc/php5/conf.d/
nano apc.ini

In the apc.ini file, write:

extension=apc.so

OR

vi /etc/php5/apache2/php.ini

write:

extension=apc.so

Finally, restart Apache:

/etc/init.d/apache2 restart

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值