安装phpredis拓展

  1. 下载phpredis拓展
mkdir /usr/local/php_extend
cd /usr/local/php_extend
wget https://github.com/phpredis/phpredis/archive/4.0.0.tar.gz
  1. 解压安装
tar -zxvf 4.0.0.tar.gz
cd phpredis-4.0.0/
phpize      或者绝对路径   /****/php/bin/phpize

失败如下情况, 则安装下yum install autoconf

Configuring for:
PHP Api Version:         20170718
Zend Module Api No:      20170718
Zend Extension Api No:   320170718
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

执行成功如下:

Configuring for:
PHP Api Version:         20170718
Zend Module Api No:      20170718
Zend Extension Api No:   320170718.
  1. 解压安装
./configure --with-php-config=/usr/local/php/bin/php-config         
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/
  1. 修改php配置
编辑php.ini 添加
extension=redis.so
extension_dir=/usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/    #第三步安装成功显示的路径 
  1. 重启php-fpm

猜你喜欢

转载自blog.csdn.net/ERIC_TWELL/article/details/103083070