{"id":5346,"date":"2014-11-19T14:06:28","date_gmt":"2014-11-19T20:06:28","guid":{"rendered":"https:\/\/secure.rosehosting.com\/blog\/?p=5346"},"modified":"2022-06-03T03:46:33","modified_gmt":"2022-06-03T08:46:33","slug":"how-to-install-xcache-on-a-centos-7-vps","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/how-to-install-xcache-on-a-centos-7-vps\/","title":{"rendered":"How to install xCache on CentOS 7"},"content":{"rendered":"
XCache is a free and open source PHP opcode cacher. Using xCache you can have better performance of your PHP scripts execution on your linux vps<\/a>. It can achieve this by eliminating the compilation time of PHP code by caching the compiled version of the PHP code into the memory and later uses the compiled version of the code. This can significantly accelerate the page generation time by up to 5 times faster and also optimizes and increases many other aspects of php scripts and reduces the server load.<\/p>\n <\/p>\n In this tutorial we will show you how to install xCache on a CentOS 7 VPS<\/a> from source.<\/p>\n First of all login to your CentOS 7 VPS and make sure that all packages on your server are up to date<\/p>\n then, install the following packages<\/p>\n Once the required packages are installed proceed with the xCache downlod. Go to their official website and grab the latest stable version of xCache. At the moment of writing this article it is version 3.2.0<\/p>\n Unpack the downloaded tarball archive<\/p>\n This will create a new ‘xcache-3.2.0’ directory. Go to that directory and<\/p>\n Execute the ‘phpize’ command to prepare xCache as a PHP extension<\/p>\n Next, we need to configure, compile and install xCache<\/p>\n The location of xcache.so is shown in the last step<\/p>\n So, the location of the xCache extension is<\/p>\n Now, we need to edit the PHP configuration file. To find its location you can execute<\/p>\n Create a configuration file for xCache, and append the following lines<\/p>\n Make sure to add the correct path of the xCache extension.<\/p>\n You can modify the settings in the xcache.ini file according to your needs.<\/p>\n Restart your Apache web server for the changes to take effect<\/p>\n At this point xCache should be successfully installed on your server. You can confirm that by executing the following command<\/p>\n Of course you don\u2019t have to do any of this if you use one of our Linux VPS Hosting<\/a> services, in which case you can simply ask our expert Linux admins to xCache for you. They are available 24\u00d77 and will take care of your request immediately.<\/p>\n PS<\/span>.<\/strong> If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":" XCache is a free and open source PHP opcode cacher. Using xCache you can have better performance of your PHP … <\/p>\nyum -y update<\/pre>\n
yum install -y php-devel gcc make<\/pre>\n
cd \/opt\r\nwget http:\/\/xcache.lighttpd.net\/pub\/Releases\/3.2.0\/xcache-3.2.0.tar.gz<\/pre>\n
tar -zxvf xcache-3.2.0.tar.gz<\/pre>\n
cd xcache-3.2.0<\/pre>\n
phpize\r\nConfiguring for:\r\nPHP Api Version:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 20100412\r\nZend Module Api No:\u00a0\u00a0\u00a0\u00a0\u00a0 20100525\r\nZend Extension Api No:\u00a0\u00a0 220100525<\/pre>\n
.\/configure --enable-xcache\r\nmake\r\nmake install<\/pre>\n
Installing shared extensions:\u00a0\u00a0\u00a0\u00a0 \/usr\/lib64\/php\/modules\/<\/pre>\n
\/usr\/lib64\/php\/modules\/<\/pre>\n
php -i |grep php.ini\r\nConfiguration File (php.ini) Path => \/etc\r\nLoaded Configuration File => \/etc\/php.ini<\/pre>\n
nano \/etc\/php.d\/xcache.ini\r\n\r\n[xcache-common]\r\nextension = \/usr\/lib64\/php\/modules\/xcache.so\r\n[xcache]\r\nxcache.shm_scheme =\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"mmap\"\r\nxcache.size\u00a0 =\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 32M\r\nxcache.count =\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1\r\nxcache.slots =\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 8K\r\nxcache.ttl\u00a0\u00a0 =\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 3600\r\nxcache.gc_interval =\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 300\r\n; Same as aboves but for variable cache\r\n; If you don't know for sure that you need this, you probably don't\r\nxcache.var_size\u00a0 =\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0M\r\nxcache.var_count =\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1\r\nxcache.var_slots =\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 8K\r\nxcache.var_ttl\u00a0\u00a0 =\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\r\nxcache.var_maxttl\u00a0\u00a0 =\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\r\nxcache.var_gc_interval =\u00a0\u00a0\u00a0\u00a0 300\r\n; N\/A for \/dev\/zero\r\nxcache.readonly_protection = Off\r\nxcache.mmap_path =\u00a0\u00a0\u00a0 \"\/dev\/zero\"\r\nxcache.cacher =\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 On\r\nxcache.stat\u00a0\u00a0 =\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 On<\/pre>\n
systemctl restart\u00a0 httpd.service<\/pre>\n
php -v\r\nPHP 5.4.16 (cli) (built: Oct 31 2014 12:59:36)\r\nCopyright (c) 1997-2013 The PHP Group\r\nZend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies\r\nwith XCache v3.2.0, Copyright (c) 2005-2014, by mOo\r\nwith XCache Cacher v3.2.0, Copyright (c) 2005-2014, by mOo<\/pre>\n