phpredis is a redis extension of php. Only with phpredis installed, php code can operate the redis database. The following only introduces how to install phpredis.
1. Download phpredis directly from the official git to the local directory (~/soft/)
git clone https://github.com/jiangtong1125/phpredis.git (git can also be packaged without installing it Download)
2. Enter the phpredis directory
cd ~/soft/phpredis/
3. Execute phpize, /usr/local/php/bin/phpize (if there are multiple php versions locally) , please use the correct version)
4. Compile./configure --with-php-c/local/php/bin/php-config
5. Compile Completed, directly execute make&&make install installation, the installation completion result
6. Enter the directory marked by the red line in the picture above, and copy the redis.so file in the directory to the extension directory of PHP
How to view php extension directory? Execute phpinfo, extension_dir is,
Copy to this directory
7. Add extension=redis.so in php.ini
8. Restart apache and check phpinfo again
well done, have fun playing! ! ! !
Copyright Statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.
The above introduces the installation of phpredis under Linux, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.