Home > Backend Development > PHP Tutorial > Using Redis+PHP under windows

Using Redis+PHP under windows

不言
Release: 2023-03-23 07:44:02
Original
1559 people have browsed it

The content of this article is the use of Redis and PHP under windows. I share it with everyone here and give a reference to friends in need.



Environment: Windows7 x64 Apache2.4 PHP5.6 mysql5.5

Materials: redis plug-in and redis server Software

Download address: redis plug-in http://windows.php.net/downloads/pecl/releases/redis/2.2.7/php_redis-2.2.7-5.6-ts-vc11-x64.zip

We can also download the redis plug-in corresponding to the PHP version according to our own needs

First enter the PHP official website

www.php.net->Select Downloads- in the navigation >Select any windows downloads in the page that appears->Select PECL extensions

in the PECL For Windows block in the page that appears->Select Download Statistics in the new page that appears-> Search for redis in the page that appears, and click the link after finding it ->Select the DLL link in the page that appears->Select the corresponding version of the

Redis extension

at the bottom of the page that appears. After downloading, you will get a ZIP compressed package. After decompression, copy the .DLL file to the ext folder in the PHP installation directory.

The extension has been obtained. Next, we download the redis server software

Download address: https://github.com/dmajkic/redis/downloads

I just downloaded the 2.2.7 plug-in, so the server I choose now must be greater than 2.2.7, but considering For version compatibility, I used the 2.2.12 version of the server

to get a zip package. After decompression, I got two versions of the server software. I used x64 and changed the folder name to redis

Let the redis server run first, open the Windows cmd window, and switch to the redis directory



##Test After success, we need to link the PHP program

First, add the module extension in php.ini

extension=php_igbinary.dll

extension=php_redis.dll

Then save and restart the Apache server

Then write a test code to test it

$redis = new Redis();

$redis->connect('127.0.0.1',6379);

$redis->set('string','hello redis');

echo $redis ->get('string');

?>

If you want the test to be successful, you must ensure that the command line window running redis is still open, that is, the redis service is still running. The test can be successful or the test fails!

Related recommendations:

Redis cluster implementation and calling using php - CSDN blog

php command sharing for operating redis

The above is the detailed content of Using Redis+PHP under windows. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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