XCache is an extension for PHP that caches its operational code. It speeds up loading time of the pages that had already been visited and overall increases the website’s loading speed.
How to install XCache on CentOS 6
- Add the Epel repository by executing the following command in terminal:
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
- Install xcache and its control panel:
yum install php-xcache xcache-admin
How to setup XCache on CentOS 6
- Open xcache configuration file:
nano /etc/php.d/xcache.ini
- Edit the following parameters:
- Memory limit for cache:
xcache.size = 60M
- CPU core count:
xcache/count = 1
- Cache’s time to live:
xcache.ttl = 0
- Memory limit for caching variables:
xcache.var_size = 4M
- CPU core count for caching variables:
xcache.var_count = 1
- Time to live for cached variables:
xcache.var_ttl = 0
- Maximum time to live for cached variables:
xcache.var_maxttl = 0
- Memory limit for cache:
- Once you are done, reboot the server:
service httpd restart
How to check the status of XCache on CentOS 6
In order to check the status of XCache, create a file info.php in the root of the website, with following content:
<?php
phpinfo();
?>
Now open your browser and go to the page http://YOUR_IP_OR_DOMAIN/info.php и in order to see the stats of PHP on your website. XCache here has a separate table (as shown higher).
How to setup XCache control panel on CentOS 6
In order to see the detailed XCache statistics, you need to set up its control panel. To do this:
- Open its configuration file by executing the following terminal command:
nano /etc/php.d/xcache.ini
- Set the following parameters:
- Username in order to access the control panel:
xcache.admin.user = "user"
- Password to the control panel in MD5-hash:
xcache.admin.pass = "5f4dcc3b5aa765d61d8327deb882cf99"
- In order to find your passwor’s hash, run the following command:
echo -n "password" | md5sum
- In order to find your passwor’s hash, run the following command:
- Username in order to access the control panel:
- Reboot the server:
service httpd restart
In order to access the XCache control panel, go to: http://YOUR_IP_OR_DOMAIN/xcache