How To Install XCache From Source

XCache is a fast, stable ​PHP opcode cacher that has been proven and is now running on production servers under high load. It is tested (on linux) and supported on all of the latest ​PHP release branches such as PHP_5_1 PHP_5_2 PHP_5_3 PHP_5_4 PHP_5_5. ThreadSafe/Windows is also perfectly supported. XCache overcomes many of the problems found with other opcachers such as being able to run with new ​PHP versions.

CentOS doesn’t come with the Dev tools, so before installing anything from source you should have the development tools, else you’ll face errors.

yum groupinstall "Development Tools"

Now, Just download xCache from the Source :- http://xcache.lighttpd.net

~/src $ wget http://... (the release url)
~/src $ tar -zxf xcache-*.tar.gz
~/src $ cd xcache
~/src/xcache $ phpize
~/src/xcache $ ./configure --enable-xcache
~/src/xcache $ make
~/src/xcache $ su
~/src/xcache # make install
~/src/xcache # cat xcache.ini >> /etc/php.ini
(it's two > not one)

(now edit /etc/php.ini with your favorite editor)
~/src/xcache # $EDITOR /etc/php.ini
(make sure zend_extension=../../xcache.so is the first before any other zend_extension=***)

That's all, it should help to optimise your PHP process and will take care of your server loads. If anyone is facing any issue while installation then just leave us a comment or email us at [email protected], we'll help solving that error.


  • If anyone is getting error with like this :- bash: phpize: command not found then kindly do the following.

    [[email protected]]# yum -y install php-devel

    It should fix the issue.