Thursday, November 7, 2013

Installing PHP XCache in CentOS / Redhat / Fedora


XCache is a fast, stable PHP opcode cacher. It accelerates the performance of PHP on servers. It increases the performance by removing the repeated compilation time of PHP scripts by caching the compiled state of PHP scripts into the RAM and uses the compiled version from the RAM thus saving the compilation time again. This will increase the speed up to 5 times.

First you install php, compilers  and Apache
yum install php  php-common  httpd php-devel gcc make

Go to the desired directory and download the xcache source package.
cd /opt/

You can download the latest one from

Extract the files.
tar -zxvf xcache-3.1.0.tar.gz

Go to the extracted directory
cd xcache-3.1.0

Start the installation. You can refer the INSTALL file which will be in the extracted directory

Prepare xcache as a PHP extension.
phpize --clean && phpize

./configure --enable-xcache

Compile the package

Install the package.
make install

Save the xcache parameters in mail php configuration file.
cat xcache.ini >> /etc/php.ini

Restart the web server
service httpd restart

That's it. You are done.

You can check whether it is enabled by running
#php -v
Or create phpinfo.php and run from the browser.

No comments:

Post a Comment

Be nice. That's all.