Home > Backend Development > PHP Tutorial > PHP installation redis extension example under Windows

PHP installation redis extension example under Windows

小云云
Release: 2023-03-20 17:36:02
Original
2796 people have browsed it

This article mainly shares with you examples of redis extension installation for PHP under Windows, hoping to help everyone.

1.php installation redis extension

1. Use the phpinfo() function to view the PHP version information, which will determine the extension file version

2. Based on the PHP version number, compiler version number and CPU architecture,

select php_redis-2.2.5 -5.6-ts-vc11-x64.zip and php_igbinary-1.2.1-5.5-ts-vc11-x64.zip

Download address:

http://windows.php.net /downloads/pecl/snaps/redis/2.2.5/

http://windows.php.net/downloads/pecl/releases/igbinary/1.2.1/

3. After decompressing, copy php_redis.dll and php_igbinary.dll to the ext directory of php

4. Modify php.ini and add:

; php_redis

extension=php_igbinary.dll

extension=php_redis.dll

Note: extension=php_igbinary.dll must be placed in front of extension=php_redis.dll, otherwise this extension will not take effect

5. After restarting Apache, use phpinfo to check whether the extension was successfully installed

Create a new test.php page

<?php
    $redis = new Redis();
    $redis->connect('127.0.0.1',6379);
    $redis->set('test','hello redis');
    echo $redis->get('test');
?>
Copy after login

hello redis

6. To use redis in Windows, you need to download the Windows version of redis software

二.php Install memcache extension

Install memcached in windows 7 64bit environment

1. After downloading, extract it to D:\memcached (download address: memcached-win64 download address)

2. Install to windows service, open cmd command line, enter the memcached directory, execute: memcached -d install command , Installing the service

If the "failed to install service or service already installed" error occurs when it has not been installed before, it means that cmd.exe needs to be run as an administrator.

3. Start the service and execute: memcached -d start

4. Install the PHP Memcache extension

Download the correct version of php_memcache. dll dynamic link library file and place it in the php5.6.16\ext directory.

5. Edit php.ini and add the following line of code to the php.ini file.

extension=php_memcache.dll

6. Check in phpinfo whether the memcache extension is installed successfully.

Related recommendations:

How to install Redis extension for PHP under win

PHP Redis extension from installation to use

How to add redis extension to php under ubuntu system

The above is the detailed content of PHP installation redis extension example 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