Home > Backend Development > PHP Problem > How to install redis3.0 extension in php

How to install redis3.0 extension in php

藏色散人
Release: 2023-03-12 08:54:02
Original
2378 people have browsed it

How to install redis3.0 extension in php: 1. Download redis3.0; 2. Extract the downloaded file to your computer; 3. Start the redis service; 4. Install the redis extension of php; 5. php Just connect and test the redis database.

How to install redis3.0 extension in php

The operating environment of this article: Dell G3 computer, Windows7 system, PHP7.2 version

How to use php Install redis3.0 extension?

Installing php redis extension (php7.2 redis3.0) under Windows 64-bit

Prerequisite: The prerequisite for building the redis extension for php7.2 is on this machine The running environment of php has been successfully set up. The running environment of my computer is apache2.4 mysql5.5 php7.2.

The operating system is 64-bit, and the compilation environment isMicrosoft visual C 2017 Redistributable

1Download redis3.0: https://github.com/MSOpenTech/redis/releases


2 Extract the downloaded file to your computer ( D:\redis), the installation is completed. [Recommended: "PHP Video Tutorial"]


#redis-cli.exe                                                                          

# Redis-Server.exe#Server

completely.windows.conf#Configuration file

## 3 redis service

Jump to the redis installation directory in the command line window (windows key R key->, enter the cmd command to enter the DOS operating system window->enter the redis installation directory ), enter redis-server redis.windows.conf in the window and press Enter. If the following interface appears, the reids service is successfully installed and started:

4 Install the redis extension of php

4.1 Download the php_redis.dll driver file,

https://windows.php.net/downloads/pecl/snaps/redis/3.1.4/

Download the corresponding redis driver file according to the version information of php

phpinfo() information

Select the corresponding file

##4.2 Unzip the downloaded php_redis driver file, find the php_redis.dll and php_redis_pdb files and copy them to the ext folder of php .

Copy to


##4.3 Modify the php.ini file and add extension

=php_redis.dll or extension = php_redis


##4.4 Verify whether the redis extension is enabled

Use phpinfo() to check if the redis extension description has been added successfully


5.5

php connects and tests the redis database

##index.php file:

##
<?php
$redis = new Redis();
$redis->connect(&#39;127.0.0.1&#39;, 6379);
$redis->set("name", "redis3.1");
echo $redis->get("name");
?>
Copy after login

Access index, the php file page displays redis3.1

Recommended: "PHP Video Tutorial"

The above is the detailed content of How to install redis3.0 extension in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template