wget -nc -q http://pecl.php.net/get/redis-6.0.2.tgz
tar -zxvf redis-6.0.2.tgz
cd redis-6.0.2
#调用phpize
/usr/local/php-8.3.7/bin/phpize
./configure --with-php-config=/usr/local/php-8.3.7/bin/php-config
make -j 4 && make install
在php.ini末尾添加:
extendsion=redis.so
重启php-fpm
写成脚本sh
prefix=/usr/local/data/php-8.2.16
php_BIN=${prefix}/bin
php_CONF=${php_BIN}/php-config
php_INI=${prefix}/etc/php.ini
phpize=${php_BIN}/phpize
php_redis(){
redis_version=redis-6.0.2
redis_pkg=$redis_version.tgz
#检查依赖,由于在centos6装过,这里解决autoconf版本问题,系统版本高自动跳过
cd $soft_home
ac_version=`autoconf -V|head -1|awk '{print $NF}'`
if [ `echo "$ac_version < 2.69"|bc` -eq 1 ];then
#rpm -e --nodeps autoconf-$ac_version
wget -nc http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
tar zxvf autoconf-2.69.tar.gz
cd autoconf-2.69
./configure --prefix=/usr/
make && make install
fi
#安装redis
cd $soft_home
wget -nc -q http://pecl.php.net/get/$redis_pkg
tar zxf $redis_pkg
cd $soft_home/$redis_version
#调用phpize
$phpize
./configure --with-php-config=$php_CONF
make -j 4 && make install
sed -i '$a extension=redis.so' $php_INI
}
评论 (0)