How can I install APC on my cPanel VPS?

APC (Alternative PHP Cache) is a free and open opcode cache for PHP which offers a robust framework for optimising and caching your PHP code. It can provide a considerable performance boosts for your websites. Whilst it isn't supported through cPanel's EasyApache (like other caches such as xcache and eAccelerator), it's quite easy to install.

Before you consider installing APC you need to ensure your PHP handler is either set to DSO or FastCGI, as unfortunately suPHP is unsupported. For the best results consider running PHP as DSO + mod_ruid2 for optimal performance and security.

To install APC please run the following from SSH:

cd /usr/local/src
wget http://pecl.php.net/get/APC-3.1.8.tgz
tar -zxvf APC-3.1.8.tgz
cd APC-3.1.8
phpize
./configure --enable-apc --enable-apc-mmap --with-apxs --with-php-config=/usr/local/bin/php-config
make
make install
cd /usr/local/src
wget http://pecl.php.net/get/APC-3.1.9.tgz
tar -zxvf APC-3.1.9.tgz
cd APC-3.1.9
phpize
./configure --enable-apc --enable-apc-mmap --with-apxs --with-php-config=/usr/local/bin/php-config
make
make install

Note: APC 3.1.9 was the latest stable release at the time this article was written, please check http://pecl.php.net/package/APC before proceeding to ensure you install the latest version.

Following your APC install, add the following lines to your global php.ini (/usr/local/lib/php.ini) to activate it:

extension="apc.so"
apc.enabled=1
apc.shm_segments=1
apc.shm_size=128

Please remember that cPanel don't provide support for APC, but the benefit it can offer and the vast amount of information available on the internet about it can certainly make it worth it.
  • 5 Users Found This Useful
Was this answer helpful?

Related Articles

Adding secondary IPs to Cpanel

  To access the IP Functions Menu, click on IP Functions, on the main screen...

Suspended page / Internal Server Error

If domain is showing "Internal Server Error" except suspention page after suspending the domain...

CPanel Log file locations

CPanel stores it’s log files in the /usr/local/cpanel/logs directory. Below is a list of the...

How do convert a dedicated ip to a shared ip on cPanel/WHM

In root SSH, copy the /etc/domainips file and then remove the IP from it: Code: cp...

Install RKHunter

You can install RKHunter on Linux Server by using following steps.1 Login to your server as...