PHP支持redis扩展

1、下载

1
wget https://pecl.php.net/get/redis-2.2.7.tgz

2、解压安装

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
tar zxvf redis-2.2.7.tgz  -C /usr/src/
cd /usr/src/redis-2.2.7/

/usr/local/php/bin/phpize 
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626

./configure --with-php-config=/usr/local/php/bin/php-config --enable-redis
[jhj@localhost redis-2.2.7]$ make
[root@localhost redis-2.2.7]# make install
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/

3、配置PHP加载扩展

1
2
3
vim /usr/local/php/etc/php.ini
添加
extension=redis.so

4、验证是否安装成功

1
2
3
4
php -m
···
redis
···

或者重启php和nginx,查看phpinfo

坚持原创技术分享,您的支持将鼓励我继续创作!