How to Install XCache to Optimize WordPress PHP Performance

Updated on Jun 16, 2022

Before you start reading this post, keep in mind that the XCache extension does not currently work with PHP 7.0+. It seems unlikely XCache will be coming back, especially because OPCache has effectively taken (and improved on) XCache’s role since PHP 7.0+.

XCache is fully supported on all FastComet Shared Hosting services. Keep in mind that PHP versions 5.5 and above include a built-in, reliable, high-performance opcode cache. The XCache extension was written prior to PHP having the built-in OPcache. You should use this extension only if you need it. In this post, we are going to show you how to boost your WordPress website performance using XCache and a cache plugin on our WordPress Hosting plans.

Keep in mind that the XCache extension does not currently work with PHP 7. We have recently ensured that our new users utilize on default PHP 7.2, thanks to the underlying benefits of it. Additionally, PHP 7.3 and PHP 7.4 are available at FastComet as well. Once the XCache extension is updated to work with PHP 7, it can be installed.

In this post, you will find:

What is XCache

XCache is an open source opcode cacher, meaning that it accelerates the performance of PHP on servers. XCache optimizes the performance by removing the compilation time of PHP scripts by caching their compiled state into the SHM (RAM). Also, XCache uses the compiled version straight from the RAM, which increases the page generation rate time by up to 5 times as it also optimizes various other aspects of PHP scripts and reduces server load. By the time of writing this post, we have already implemented the XCache support on all FastComet Shared Hosting services.

How to Enable XCache via cPanel

XCache can be enabled for your hosting account with a few clicks. Keep in mind that this feature is not available by default in cPanel. If your cPanel hosting does not support XCache, you may consider transferring your website to FastComet. Our technical support team offers free website transfer and 24/7 technical support so you can start the switch right away.

To activate the XCache, please login into your cPanel and refer to the Select PHP Version under the Software and Services section. From the PHP selector interface, you can activate the XCache extension and save your settings. For a detailed step by step instructions, you may follow our guide on How to Configure XCache via cPanel.

Configure WordPress with XCache Opcode Cacher

To configure WordPress with XCache, you will need to upload a single file under your /wp-content/ directory.

First, let's download the XCache object-cache file. You can download the extension via the official WordPress website – XCache Object Cache Backend. Extract the extension archive on your local computer and open the new folder. You should be able to locate the file:

object-cache.php

You can upload the backend cache file under your wp-content directory via both FTP and your cPanel → File Manager. Either way, navigate to your WordPress root folder where your wp-content/ directory is located and upload only the object-cache.php file.

You do not need to edit the file after the upload. As soon as you have it uploaded, you should see the extension under the drop-ins in your WordPress Plugins section.

Possible Errors

If you see the following error:

XCache is not configured correctly. Please refer to https://wordpress.org/extend/plugins/xcache/installation/ for instructions.

Most probably XCache is not enabled for your account. Feel free to contact our tech support experts. They work 24/7 and are ready to assist you at all times. You can also ask them to uninstall an existing XCache extension for you.

Uninstalling XCache Manually

If you wish to uninstall the XCache extension by yourself, you need to run the following command as root:

sudo rm /etc/phpX.Y-sp/conf.d/xcache.ini

Next, restart PHP-FPM with the command:

sudo service phpX.Y-fpm-sp restart

Contact us for Assistance

In case still need assistance, feel free to open a support ticket. Our expert technical support team works 24/7 and will help every customer solve their problems. Also, if you are not yet our client, you can check our price list and decide if we are a good choice for your hosting solutions.

We hope you find this article useful. Discover more about FastCloud - the top-rated Hosting Solutions for personal and small business websites in four consecutive years by the HostAdvice Community!

WordPress Hosting

  • Free WordPress Installation
  • 24/7 WordPress Support
  • Free Domain Transfer
  • Hack-free Protection
  • Fast SSD Storage
  • Free WordPress Transfer
  • Free CloudFlare CDN
  • Immediate Activation
View More