How to Install XCache - Optimize PHP Performance

To Install XCache to Accelerate and Optimize PHP Performance

XCache is a fast, stable PHP opcode cacher that has been tested and is now running on production servers under high load. It is tested on GNU/Linux and FreeBSD supported. It is relatively new opcode caching software developed by mOo.

First install and enable the EPEL repository. Once you EPEL repo installation is completed, then install XCache by using the following command.

[root@linuxhelp html]# yum install php-xcache xcache-admin
Loaded plugins: aliases, changelog, fastestmirror, kabi, presto, refresh-packagekit, security, tmprepo, verify, versionlock
Loading support for CentOS kernel ABI
Setting up Install Process
Loading mirror speeds from cached hostfile
epel/metalink           3.3 kB     00:00    
.
.
.                                                     
Installed:
  php-xcache.x86_64 1:3.2.0-1.el6.remi.5.6       xcache-admin.noarch 1:3.2.0-1.el6.remi.5.6                

Complete!

Once the installation is completed, start editing the configuration file.


Configuration file

[root@linuxhelp html]# vim /etc/php.d/40-xcache.ini

Here, the default configuration has been made if you want to configure by own. For example, if you want to configure it as a admin portal such as username and password your can modify here.

After the modification is completed, use the below command to view the PHP version.

[root@linuxhelp html]# php -v
PHP 5.6.21 (cli) (built: Apr 28 2016 07:47:46) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    .
    .
    with xcache Coverager v3.2.0, Copyright (c) 2005-2014, by mOo

Now create the one php file in web root directory (i.e /var/www/html) and enter the following statement into that directory.

[root@linuxhelp html]# vim info.php

Now restart the Apache service.

[root@linuxhelp html]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]

Now open the web browser, enter your server-ip or hostname with HTTP protocol with configuration file was create under web root directory.
http://server-ip/info.php
or
http://localhost/info.php





Tag : Xcache
FAQ
Q
Why Apache2 keeps getting segmentation faults with cache larger than 4M?
A
For that you have to set
Syntax: "Set "xcache.readonly_protection = On" in php.ini"
Q
Why is my cache being cleared?
A
You are Setted PHP_FCGI_CHILDREN to 1 or greater if you're using php FastCGI.
Q
What is the command to install Xcache in Ubuntu?
A
By using this command you can install
Syntax: "apt-get install php5-xcache"
Q
What if I'm getting "undefined symbol"?
A
If your php is configured --enable-versioning, disable it. It's broken. If you insist on versioning, build XCache as a static module of php.
Q
Where Is ./configure file in a system?
A
You have to install php first, which gives you "phpize" executable(script), and do
~/src/xcache $ phpize
(generating configure)
~/src/xcache $ ./configure --help
~/src/xcache $ ./configure --enable-