Home >Backend Development >PHP Tutorial >php redis扩展装配、配置、使用小结
php redis扩展安装、配置、使用小结
系统是lamp环境(centos6.7+apache2.2+mysql5.7+php5.3),默认
软件下载到/usr/local/src目录下 redis安装在/app/local/redis目录下
#wget http://download.redis.io/releases/redis-2.8.24.tar.gz
#tar zxvf redis-2.8.24.tar.gz
#mkdir -p /app/local/redis
#cd redis-2.8.24
#make PREFIX=/app/local/redis install
启动redis
#/app/local/redis/bin/redis-server
接着安装phpredis扩展
#wget https://github.com/nicolasff/phpredis/archive/2.2.4.tar.gz
#tar zxvf 2.2.4.tar.gz
#cd phpredis-2.2.4
#/app/local/php/bin/phpize #生成configure配置文件
出现如下说明生成了配置文件
[[email protected] phpredis-2.2.4]# /app/local/php/bin/phpize Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
#./configure --with-php-config=/app/local/php/bin/php-config
#make && make install
最后生成扩展文件
Installing shared extensions: /app/local/php/lib/php/extensions/no-debug-non-zts-20090626/
接着配置php.ini
#vi /app/local/php/etc/php.ini
在extension后添加
extension=redis.so
:x
重启apache
#/app/local/apache/bin/apachectl restart
最后在phpinfo里查看redis扩展是否加载
如下图所示: