1. 安裝redis
Redis安裝流程請移步 https://www.cnblogs.com/IT-Crowd/articles/10626765.html
2. 下載Redis擴展
[root@root php-extension]# wget https://pecl.php.net/get/redis-4.3.0.tgz
3. 解壓 tar -zxvf redis-4.3.0.tgz
[root@root php-extension]# tar -zxvf redis-4.3.0.tgz
4. 生成configure配置文件
[root@root php-extension]# cd redis-4.3.0
[root@root redis-4.3.0]# /usr/local/php/bin/phpize
5.安裝redis擴展
[root@root redis-4.3.0]# ./configure --with-php-config=/usr/local/php/bin/php-config
[root@root redis-4.3.0]# make && make install
安裝完成提示:
Build complete.
Don't forget to run 'make test'.
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/
6.在php.ini中添加Redis擴展
首先配置extension_dir:
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/"
在extension_dir下面添加 extension = redis.so
7.重啟PHP
[root@root redis-4.3.0]# service php-fpm restart
8.Redis擴展安裝成功