How to install xCache on CentOS/RHEL 5/6/7

Share It!

XCache is a quick, stable PHP opcode cacher. This generally new opcode caching software has been produced 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 increment php execution 1-5 times quicker than default installation.

xcache_logo

Step 1: Install XCache for PHP


You can simply use yum command to install xcache for php.

# yum install php-xcache xcache-admin

Step 2: Configure XCache


XCache creates its default php configuration file xcache.ini. This file contains a long list of parameters

# vim /etc/php.d/xcache.ini

Step 3: Verify XCache


Create a php info file using below content and upload to your web server under document root. Open this file in browser and search for xcache.

# vim /var/www/html/info.php
<?php
phpinfo();
?>

xcache_3

xcache_2

Step 4: Configure XCache Admin Panel


XCache also gives admin panel by which we can view caching state, clear store or disabled. Utilizing default installation it’s not enabled. Below setup will enable XCache admin panel with password protected.

  • Copy xcache folder to your document root of your web server.
    # cp -r /usr/share/xcache /usr/local/apache2/htdocs
    
  • Generate password for xcache admin panel using below commands.
    # echo -n "secreatpassword" | md5sum
    

    Output:

    753f51a9cca136b41c5f7cced1f813dd  -
    
  • Search [xcache.admin] section in xcache.ini and update as below.
    # vim /etc/php.d/xcache.ini
    
    [xcache.admin]
    xcache.admin.enable_auth = On
    xcache.admin.user = "xadmin"
    ; set xcache.admin.pass = md5($your_password)
    ; login use $your_password
    xcache.admin.pass = "753f51a9cca136b41c5f7cced1f813dd"
    
  • Restart httpd server to enable new settings.
    For CentOS/RHEL 5/6:
    # /etc/init.d/httpd restart
    For CentOS/RHEL 7:
    # systemctl restart httpd
    
  • Access XCache admin panel in browser using ip or domain name by location sub directory using above configured username password.
    http://techoism.com/xadmin/
    Login: xadmin / secreatpassword
    
  • xCache

    xCache_1

    Leave a Reply

    Your email address will not be published.