Aug 11 2008

[Linux] Decreasing server CPU load with PHP APC cache extension

Category: Articles,Linux administrationFractalizeR @ 1:44 am

As you know, each time php script is executed, PHP interpreter need to compile it first to bytecode and only after that – execute. That compilation takes much time.

APC PHP extension (which will be included and enabled in PHP6 by default. It becomes a standard) can speedup php script execution process by caching once compiled PHP bytecode in memory. So, installing this extension increases your server performance (we assume you are doing this at CPanel/WHM controlled server). To install extension just do the following:

cd usr/local
mkdir apc
cd apc
After issuing the last command you will have an archive with latest APC source downloaded to your current directory. At the time of writting this article it is APC-3.0.16.tgz. Let’s proceed with unpacking it.
tar -zxvf APC-3.0.16.tgz
cd APC-3.0.16
make install
Now locate your php.ini and open it with your default editor. Add anywhere (at the very end for example) the following line:


service httpd restart

Now apc extension should be loaded together with your PHP. To test if it is, just take apc.php file from your installation and put it to the directory accessible by your webserver. Open URL in browser and check how your APC is working for you.

This article is also published at official CPanel/WHM forum:

Tags: , ,

One Response to “[Linux] Decreasing server CPU load with PHP APC cache extension”

  1. madalin says:


Leave a Reply

You must be logged in to post a comment. Login now.