关闭

Installing APC op-code cache on Ubuntu 10.04

740人阅读 评论(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

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:383452次
    • 积分:5042
    • 等级:
    • 排名:第5775名
    • 原创:87篇
    • 转载:257篇
    • 译文:0篇
    • 评论:14条
    文章分类
    最新评论