Install The Latest APC Opcode through PECL on Debian 6 and How it Works

I have finished migrated this blog from Jakarta to Milan. The reason is BlackFriday coupon. Yes! I got an offer from iwStack/prometeus in LET community. I couldn’t leaving this precious offer.

On my previous server (Jakarta, CloudKilat), actually I didn’t have any issue. All thing work smoothly. But, as I said, I couldn’t leaving this precious offer.

On the previous server, I have 1 Gigs ram. I never thought about resources, but here at iwStack I have only 384 MB. So I have to save any resource.

To Save resources, I have good experiences with APC opcode. I installed it on my DigitalOcean blog, here the result I got.

So what exactly APC doing?

APC or Alternative PHP Cache was founded by Brian M. Shire from facebook. He did a research how to handle a significant growth of facebook. Facebook is dynamic site, everytime/everywhere people connect around the world, in the same time peoples compiled php code from the server.

That kind of thing make server load heavier. The APC founded, APC work to convert PHP source code into opcode. After that the opcode cached stored to make it even faster.

Apc Facebook

Apc Facebook

You can download about details here or read it from scribd.

Let’s Install APC

I Installed APC on nginx, but you can install it on any webserver.

To make sure we install the latest version, we will build it from source.

You will be asked few questions, you can hit enter to accept and agree with all questions. I used the following to install APC:

Enable internal debugging in APC [no] : no
Enable per request file info about files used from the APC cache [no] : no
Enable spin locks (EXPERIMENTAL) [no] : no
Enable memory protection (EXPERIMENTAL) [no] : no
Enable pthread mutexes (default) [no] : yes
Enable pthread read/write locks (EXPERIMENTAL) [yes] : no

The last thing you have to do is create the apc.ini in /etc/php5/conf.d/ directory.

Copy this code and repleace the current one if ou have any. You don’t need to understand what is the meaning behind this. I had done the best practice to make that. All you have to understand is, how much you will allocate memory for APC in apc.shm_size section. My case, I allocated 96 MB

Finaly, in order to monitor the usage you have to move /usr/share/php/apc.php to somewhere you can access it.

Dont forget to restart the php and webserver!

0 comments… add one

Leave a Comment