linux's docs

24.7.0: 扩展模块-redis


1. redis php扩展

# 下载phpredis扩展包
mkdir php-redis
git clone https://github.com/phpredis/phpredis.git php-redis/

# 使用php初始化环境,并编译phpredis
cd php-redis
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install
Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/

# 查看模块路径
ls /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/redis.so
/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/redis.so

# 编辑php配置文件
vim /usr/local/php/etc/php.ini
**********************************
# 增加模块
extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/redis.so
**********************************

# 重启php服务
/etc/init.d/php-fpm restart

# 查看模块是否加载
/usr/local/php/bin/php -m|grep redis
redis

Contents