Redis Installation in Window: Step1

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

Jagannath Maji

Redis

Redis Installation in Window


Step1: Go to this Url to download Redis for Windows
and download the .zip file
Releases · tporadowski/redis · GitHub
Jagannath Maji

Step2: Extract the .zip to a folder to any location.

• I have extracted the redis files in my


D:\E\Redis folder.

These two files are important


1. By clicking on redis-server we can
start redis server.
2. By clicking on redis-cli we can start
redis client
Jagannath Maji

Step3: Set the Environment variable path for running the


redis server on normal cmd.
• Open “edit environment variable”
• Click on “path” then click on “edit”
• Click on “new”
• Paste the path where your redis files has extracted.
Jagannath Maji

Step4:
• Open “cmd” prompt
• Type redis-server to start redis server.
• Open another “cmd” prompt and type redis-cli to
start redis client.
• Type ping on redis client cmd prompt
• If it will reply with pong that means redis server
successfully installed on your machine.
Jagannath Maji

Working in Redis with PHP using Xampp server.


Step1: (Downloading phpredis package)
• For work in Redis with PHP using xampp server we
need to download phpredis package. Link for
download phpredis package is:
PECL :: Package :: redis (php.net)

• Click on DLL file link of new release version.


Jagannath Maji

• We will be redirected to a new page .By scrolling down


the page we will be able to see the DLL list. Click on
New PHP verson Thread safe dll zip file and download
it.
Jagannath Maji

Step2: (Extracting zip file AND Next steps)


• Extract the zip file to any where
• We will see a php_redis.dll file inside the extracted
folder.

I have extracted it
here
Jagannath Maji

• Copy this file and paste it inside the xampp server


php/ext folder
Paste the
php_redis.dll file
inside
xampp/php/ext
folder
Jagannath Maji

• Open the php.ini file and write extension=php_redis.dll in


that file

I have modified the php.ini file by writing


extension=php_redis.dll
here
Jagannath Maji

Step3: (Xampp server start)


• Strat Xampp server
• Type localhost on your browser url
• Click on PHPInfo
• If We able to see Redis in that page that means we
have successfully configure Redis with Xampp.
Jagannath Maji

Step4: (Write a PHP code to test our connection)


• I have written a redisdemo.php page inside the
Xampp/htdocs/Redis_Demo folder
redisdemo.php
<?php
try{
$redis=new \Redis();
$redis->connect('localhost',6379);
echo "Connection Established ";
$redis->set('User','Jagannath');
$user=$redis->get('User');
print($user);
}catch(Exception $e){
echo $e;
}
?>

• Start redis server in a cmd prompt by typing


redis-server
• Start redis client in another cmd prompt by typing
redis-cli
Jagannath Maji

• Run the redisdemo.php page by typing


http://localhost/ Redis_Demo/redisdemo.php
On my browser url
• I got this output

We can also see In my Redis client the “User” key and


value are added

You might also like