How To Use Redis Object Caching For WordPress

How To Use Redis Object Caching For WordPress?

Hiking concept web template Free Psd

In order to initiate the process of using Malaysia AV Discovery Redis for object caching in case of WordPress pages, the initial step is installing Redis and later configuring it followed by an installation of PHP extension. After this one needs to install Redis Object Cache plug-in for a speedy and smooth process.

 

An important aspect to be noted is that a number of WordPress hosts by default offer already installed Redis object caching. Even if the feature is not available one can simply do the installation process manually.

 

The installation:

 

In case one opts for installing Redis manually on Linux server, a number of prerequisites exist.

  • Capability for installing Redis via SSH access
  • WordPress needs to be installed
  • PHP version required should be either 7.0 or higher
  • Server should have both Sudo and Wget
  • A valid Text editor should be installed on the server for instance Nano
  • Phpize needs to be installed in order to prepare the PHP extension compilation
  • Entire site needs to be backed
  • Redis needs to be efficiently tested

 

  1. For Installing Redis 
  • Redis can be installed by entering the following

wget http://download.redis.io/redis-stable.tar.gz

  • Next this has to be typed

tar xvzf redis-stable.tar.gz

  • Which has to be followed with,

cd redis-stable

  • After which this has to be entered,

Make

 

  1. To Configure Redis as Cache

It is extremely essential to configure the file after installation of Redis

Inorder to get the configuration link, following line is used,

Sudo nano /etc/redis/redis.conf

One thing to be noted here is that “nano” is a command used to acquire access of the file Note that “nano” is the command to access the file using the Nano editor. Replace this with the applicable command if you have a different editor installed.

 

  1. How to edit wp-config.phpFile

Redis is formulated to have access of data stored from all apps. Inorder to avoid any security brawl arising from this, the wp-config.php needs to be edited.

For this one needs to open wp-config.php file and enter

define( ‘WP_CACHE_KEY_SALT’, ‘example.com:’ );

It goes without saying that “example.com” needs to be replaced with what is relevant to the user. A random key value can be generated using some tool like KeyGen.io or even Random Key Gen for instance. This key value is very crucial and therefore needs to be carefully safeguarded to ensure privacy and security.

 

  1. 4. Install PHP Extension

Inorder to enable WordPress to link to Redis for enabling object caching it is vital to have installed a PHP extension for instance PHP Redis. Inorder to do this one needs to alter the command line and enter,

wget https://github.com/nicolasff/phpredis/archive/master.zip

This should be followed with,

unzip master.zip

And later this has to be entered,

cd phpredis-master

This would download as well as have installed a source code. Redis installation can be easily done through Linux server. Microsoft has specifically developed Win 64 port of Redis to facilitate object caching of WordPress through Redis!