: This article mainly introduces how to add the Redis module in PHP. if you are interested in the PHP Tutorial, refer to it. Several articles have introduced the installation and use of Redis. The following describes how to add Redis extension in php!
The php Manual does not provide Redis classes and methods or related extension modules, but we can download PHP extensions from the official Redis website, take phpredis as an example.
- Download phpredis
- Click "Repository" to enter the Redis Learning Library, which contains the Redis extended code file and related introduction and classes and methods.
- Click "releases" to go to the phpredis source file.
- Download the latest phpredis source file and select "tar.gz" to download it.
- Phpredis configuration
- Decompress the phpredis file
1 tar -zxvf phpredis-2.2.7.tar.gz
- Install and configure phpredis
- Run the phpize5 command in the phpredis directory to generate the configure file
phpize5
- Install and configure igbinary
wget http://pecl.php.net/get/igbinary-1.2.1.tgz./configuremakesudo make install
- Install and configure phpredis
./configure --enable-redis-igbinarymake
sudo make install
- Modify php. ini and add (add igbinary. so first and then redis. so in order)
extension=igbinary.soextension=redis.so
- View phpredis
View with phpinfo ()
Reference:
Php-Redis installation test summary
The above describes how to add the Redis module in PHP, including related content, and hope to help those who are interested in the PHP Tutorial.