php添加phpredis擴展方法步驟

redis安裝上篇文章已經講過

1、先下載phpredis

wget https://codeload.github.com/phpredis/phpredis/zip/develop

2、解壓develop

unzip develop

ll

drwxr-xr-x 11 root  root      4096 10月 23 14:11 phpredis-develop

3、編譯安裝

cd phpredis-develop

/usr/local/php/bin/phpize

./configure --with-php-config=/usr/local/php/bin/php-config

make && make install

install之後redis.so 文件安裝在/usr/local/php/lib/php/extensions/no-debug-non-zts-20151012文件之中

4、配置php.ini文件

echo extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20151012" >> /usr/local/php/etc/php.ini

echo extension=redis.so >> /usr/local/php/etc/php.ini

5、重啟nginx 或者apache,我安裝的是nginx

/usr/local/nginx/sbin/nginx -s reload

6、查看是否添加成功

php -m

查看是否已有redis

或者phpinfo();

You May Also Like