How to check if Redis connection Establishes with PHP?

In order to check if the Redis connection establishes successfully on your website with PHP, create the file redischeck.php on the root folder ( /home/username/public_html ) of your website with the content below:

PHP:

<?php
// Connecting to Redis server on localhost
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
echo "Connection to server successfully";
// Check whether the server is running or not
echo "The server is running: ".$redis->ping();
?>

Start a new tab in your browser and type: yourdomain/redischeck.php ( Make sure to replace your domain name with yourdomain.tld )

If the result is:

Connection to server successfully
The server is running: PONG

Redis is working normally. If not, install Redis, please check our KB for the installation process/guide!

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to restrict direct root access in Linux

We can do it just in two steps. Step One: At first we will create new root user as follows (for...

How to extract .tar.gz files in Linux/UNIX OS

A tarball is a group of files that are bundled together using the tar command. Use the...

How to add welcome message when SSH start?

You need to change the contents of /etc/motd. Unfortunately, by default, /etc/motd is a link to...

How to change root password when SSH logged in

Run the following command: passwd Now type your new passwordOnce done, retype new passwordDone!...

How to install Pinguzo on any Linux/UNIX OS

Login to Pinguzo panel using Softaculous account or create an account of Pinguzo To add new...