最新消息:imsyx老店新开,原博客因服务器问题,数据全毁,痛心!

Centos LNMP一键安装包安装Redis PHP扩展

服务器 tally 1004浏览

环境:centos lnmp一键安装包

1、进入比如mnt目录,下载redis扩展:
cd /mnt
wget http://pecl.php.net/get/redis-5.3.7.tgz
tar -zxvf redis-5.3.7.tgz
cd redis-5.3.7
/usr/local/php/bin/phpize

1.1、可能会报错:
configure.ac:3: error: Autoconf version 2.68 or higher is required

1.1.1、卸载自带的 Autoconf:
rpm -e –nodeps autoconf-2.63

1.1.2、安装新版本:
cd /mnt
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
tar -zxvf autoconf-2.69.tar.gz
cd autoconf-2.69
mkdir -p /usr/local/autoconf
./configure –prefix=/usr/local/autoconf/
make && make install

1.1.3、查看版本:
/usr/local/autoconf/bin/autoconf -V

2、再次安装Redis扩展
cd /mnt/redis-5.3.7
usr/local/php/bin/phpize

2.1 可能会报错:
Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF

2.2 创建软连接
ln -s /usr/local/autoconf/bin/autoconf /usr/local/bin/autoconf
ln -s /usr/local/autoconf/bin/autoheader /usr/local/bin/autoheader
ln -s /usr/local/autoconf/bin/autom4te /usr/local/bin/autom4te
ln -s /usr/local/autoconf/bin/autoreconf /usr/local/bin/autoreconf
ln -s /usr/local/autoconf/bin/autoscan /usr/local/bin/autoscan
ln -s /usr/local/autoconf/bin/autoupdate /usr/local/bin/autoupdate
ln -s /usr/local/autoconf/bin/ifnames /usr/local/bin/ifnames

3、再次安装Redis扩展
cd /mnt/redis-5.3.7
usr/local/php/bin/phpize
./configure –with-php-config= /usr/local/php/bin/php-config
make && make install

4、修改php.ini文件,添加:extension=redis.so

5、lnmp restart

6、phpinfo查看

转载请注明:小码农 » Centos LNMP一键安装包安装Redis PHP扩展