APC Cache Activation and disable XCache

Tags: apccachephp

Published on: August 6, 2014 by Vipin R.N

APC Cache Activation and disable XCache


A Client asked me to install APC Cache in his server and to disable XCache.

OS Cent OS
Control Panel cPanel/WHM
WebServer Apache 2
PHP version 5.x


Before we get into the details, lets take a look at some basics. XCache and APC Cache belong to the family of PHP Accelerators.

PHP Accelerator
A PHP accelerator is a PHP extension designed to improve the performance of software applications written in the PHP programming language.

Most PHP accelerators work by caching the compiled bytecode of PHP scripts to avoid the overhead of parsing and compiling source code on each request (some or even most of which may never be executed). To further improve performance, the cached code is stored in shared memory and directly executed from there, minimizing the amount of slow disk reads and memory copying at runtime.

PHP accelerators can substantially increase the speed of PHP applications. The effect on application performance of opcode caching varies widely, depending on factors such as the inherent execution time of the PHP application and the percentage of source code actually executed on a given request, and whether additional optimization steps are performed. While a code optimizer may even slow down overall performance when used in isolation, it can provide an additional performance boost when coupled with a bytecode cache, as the optimization effort is performed just once.

CMS Applications which involves complex PHP coding such as WordPress, Joomla etc make effective use of PHP Accelerators. The most popular PHP Accelerators are XCache and APC Cache.

Install APC Cache

(a) The Easy way aka WHM

Well, WHM is there. You can almost do anything with it 

After logging into WHM, navigate to Software » Module Installers then click on Manage against PHP Pecl. Search for “APC” in Find a PHP Pecl and then choose to “Install” in the APC result that will come up. Screenshots following :




After installing it, you should see the Module listed :


b) Via Shell

Lets go !

Before install APC cache, you’ve to ensure eAccelerator is enabled on the server .

Checking eAccelerator

# php -m | grep eAccelerator


Go ahead now, the commands are self-explanatory

# cd /usr/local/src

# wget

# tar -xzf APC-3.0.19.tgz && cd APC-3.0.19
# 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

phpize: The phpize command is used to prepare the build environment for a PHP extension.

This should now configure APC and install it in your extension directory (can change from server to server). You can locate it from the PHP configuration file /usr/local/lib/php.ini at this line :

; Directory in which the loadable extensions (modules) reside.

extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20090626"

Now descend to the folder

[~]# cd /usr/local/lib/php/extensions/no-debug-non-zts-20060613

You can locate a file named in that directory.

You can now locate an entry for in the PHP configuration file /usr/local/lib/php.ini. Uncomment it if it was commented, finally the line should look like :


Disabling XCache is extremely easy, just comment the line to make it look like :


Finally, restart the Webserver

/etc/init.d/httpd restart

Make a phpinfo page in any user accounts and confirm this. You should not see anything about XCache there, only APC. Just like this :


Category : Apache, cPanel, Linux

Vipin R.N

Vipin R.N

Vipin is a no-nonsense, disciplined guy who ensures that everything is carried out with the highest level of perfection. Apart from his great coding skills, he is quite interested in advanced server administration, issue analysis, documentation and training. In-depth knowledge in international politics, ammunition and automobiles makes this hard core Manchester United fan, one of the most referenced personalities in the entire team.

You may also read:


Add new commentSIGN IN

Let's Connect


Your Cart

Cart is empty.

Send this to a friend