Webhosting Blog

Enabling APC on cPanel server


What is APC:

The Alternative PHP Cache (APC) is a free and open opcode cache for PHP. Its goal is to provide a free, open, and robust framework for caching and optimizing PHP intermediate code. Apart from caching opcode cache it provides a user cache for storing application data.

Installing APC on cPanel server :

Before installing APC on the server ensure eAccelerator is enabled on the server .

root@server [~]# php -m | grep eAccelerator
eAccelerator

Now lets install APC on the server . Follow the following commands on the server :

root@mailspec [~]# cd /usr/local/src

root@mailspec [~]# wget http://pecl.php.net/get/APC-3.0.19.tgz

root@mailspec [~]# tar -xzf APC-3.0.19.tgz && cd APC-3.0.19

root@mailspec [~]# phpize && ./configure –enable-apc –enable-apc-mmap –with-apxs=/usr/local/apache/bin/apxs –with-php-config=/usr/local/bin/php-config && make && make install

This should now configure APC and install it in your extension directory.

root@mailspec [~]# cd /usr/local/lib/php/extensions/no-debug-non-zts-200XXXX

You can locate a  file named apc.so in that directory.

You can now locate an entry for apc.so in the file /usr/local/lib/php.ini.

extension=”apc.so”

If you want to view APC interface via browser you can copy the file /usr/lib/php/apc.php into your sites documentroot path and access it via the browser. Ensure GD is installed on the server to view APC interface via the browser.

You can try accessing the URL:: http://domain.com/apc.com to view the interface

(replace the domain.com with your original domain name )

It will show you interface similar as follows :



Advertisements

4 responses

  1. Pingback: Install PHP 5.3 mcrypt extension on Centos 5.6 « Php Bugs

  2. Jamal

    Why do you need to make sure that eaccelerator is enabled? APC does essentially the same thing as eAccelerator. Why does it need to be enabled as well?

    August 2, 2012 at 4:47 am

    • You can use either APC or eAccelerator. Now a days we mostly use APC due to its support features as well as its easy adaptability.

      August 30, 2012 at 5:58 pm

  3. dmacleo

    you MAY need to rename apc.so to APC.so after building.
    especially if installed through cpanel pecl first and are updating to latest, cpanel is behind a few.

    September 10, 2012 at 2:28 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s