In this tutorial, we will show you how to install and configuration of XCache on your CentOS 7 server. For those of you who didn’t know, XCache is an open-source opcode cacher, which means that it accelerates the performance of PHP on servers. It optimizes performance by removing the compilation time of PHP scripts by caching the compiled state of PHP scripts into the shm (RAM) and uses the compiled version straight from the RAM. This will increase the rate of page generation time by up to 5 times as it also optimizes many other aspects of PHP scripts and reduces server load.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple. I will show you through the step-by-step installation XCache in CentOS 7 server.
Install XCache on CentOS 7
Step 1. First, let’s start by ensuring your system is up-to-date and add EPEL (Extra Packages for Enterprise Linux) yum repository your system:
rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm yum -y update
Step 2. Installing XCache and any required packages:
yum -y install php-xcache xcache-admin
Now verify that the extension is available by using the following command:
php -m | grep XCache
XCache XCache Cacher XCache Coverager XCache Optimizer XCache XCache Cacher XCache Coverager XCache Optimizer
Restart your Apache web server for the changes to take effect:
systemctl restart httpd.service
At this point, XCache should be successfully installed on your server. You can confirm that by executing the following command:
### php -v PHP 5.4.16 (cli) (built: Oct 31 2014 12:59:36) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies with XCache v3.2.0, Copyright (c) 2005-2014, by mOo with XCache Cacher v3.2.0, Copyright (c) 2005-2014, by mOo
Congratulations! You have successfully installed XCache for PHP. Thanks for using this tutorial for installing XCache on your CentOS 7 system. For additional help or useful information, we recommend you check the official XCache website.