How To Install XCache for PHP on CentOS
How To Install XCache for PHP on CentOS? XCache is a fast, stable PHP opcode cacher. This relatively new opcode caching software has been developed by mOo. XCache optimizes performance caching the compiled state of PHP scripts into the RAM and uses the compiled version straight from the RAM. This may increase php execution 1-5 times faster than default installation
Install XCache for PHP on CentOS
First add EPEL yum repository your system.
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-1.noarch.rpm
Install XCache for PHP
yum install php-xcache xcache-admin
Configuring of XCache for PHP
nano /etc/php.d/xcache.ini [xcache-common] extension = /usr/lib64/php/modules/xcache.so [xcache] xcache.shm_scheme = "mmap" xcache.size = 32M xcache.count = 1 xcache.slots = 8K xcache.ttl = 3600 xcache.gc_interval = 300 ; Same as aboves but for variable cache ; If you don't know for sure that you need this, you probably don't xcache.var_size = 0M xcache.var_count = 1 xcache.var_slots = 8K xcache.var_ttl = 0 xcache.var_maxttl = 0 xcache.var_gc_interval = 300 ; N/A for /dev/zero xcache.readonly_protection = Off xcache.mmap_path = "/dev/zero" xcache.cacher = On xcache.stat = On
You can modify the settings in the xcache.ini file according to your needs. Detailed explanation about these settings you can find at the xCache official wesbsite.
Restart your Nginx web server
service nginx restart
php -v PHP 5.5.20 (cli) (built: Dec 31 2014 00:46:99) 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
Congratulation’s! You have successfully installed XCache for PHP.