PHP版本更新至7.4.10版本

1 篇文章 0 订阅

卸载yum安装的php
1、杀掉php进程:killall php-fpm &> /dev/null

2、查找php安装包:rpm -qa|grep php

3、卸载php安装包:

rpm -e php70w-pear php70w-pecl-apcu-devel php70w-intl php70w-cli php70w-devel php70w-pdo php70w-xml php70w-pecl-redis php70w-mysqlnd php70w-opcache php70w-process php70w-pecl-igbinary php70w-gd php70w-mbstring php70w-common php70w-pecl-apcu php70w-pecl-imagick php70w-mcrypt php70w-fpm

卸载阿里云一键安装包安装的php
1、停止php进程:/etc/init.d/php-fpm stop &> /dev/null

2、杀掉php进程:killall php-fpm &> /dev/null

3、删除php安装目录:rm -rf /alidata/server/php

4、备份php安装目录:cp -r /alidata/server/php-* /alidata/server/php-5.5.7.bak

升级php版本
1、查看之前php安装配置信息:php -i|grep configure

2、安装编译命令:

./configure --prefix=/alidata/server/php-7.4.10 --enable-opcache --with-config-file-path=/alidata/server/php-7.4.10/etc --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-fpm --enable-static --enable-inline-optimization --enable-sockets --enable-calendar --enable-bcmath --enable-soap --with-zlib --with-iconv --enable-gd --with-xmlrpc --enable-mbstring --with-pdo-sqlite --with-curl --enable-ftp --disable-ipv6 --disable-debug --with-openssl --disable-maintainer-zts --disable-fileinfo --with-freetype=/usr/local/freetype-2.10.0 --with-jpeg=/usr/local/jpeg-9c

安装命令:

make && make install

将安装目录内连接至新目录

ln -s /alidata/server/php-7.4.10/ /alidata/server/php

拷贝php配置文件

cp /data/php-7.4.10/php.ini-development /alidata/server/php/etc/php.ini
cp /alidata/server/php-7.4.10/etc/php-fpm.conf.default /alidata/server/php-7.4.10/etc/php-fpm.conf
cp /alidata/server/php/etc/php-fpm.d/www.conf.default /alidata/server/php/etc/php-fpm.d/www.conf
cp /data/php-7.4.10/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

4、 赋予脚本可执行命令,添加开机自启动

chmod +x /etc/init.d/php-fpm
chkconfig --add php-fpm
chkconfig php-fpm on

5、 php-fpm service 相关命令:
  php-fpm启动命令:service php-fpm start
  php-fpm停止命令:service php-fpm stop
php-fpm重启命令:service php-fpm restart

2.安装memcached扩展
2.1安装libmemcached

wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
./configure --prefix=/usr/local/libmemcached
make && make install

2.2安装memcached

wget https://pecl.php.net/get/memcached-3.1.5.tgz --no-check-certificate
tar xf memcached-3.1.5.tgz
cd memcached-3.1.5
/alidata/server/php/bin/phpize
./configure --enable-memcached --with-php-config=/alidata/server/php/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached --disable-memcached-sasl
make && make install

最后一步在 php.ini 中引入 memcached.so

[root@lnmp memcached]#

vi /alidata/server/php/etc/php.ini
extension=memcached.so

问题一:Excel导出抛err_invalid_response问题,需要安装zip扩展
使用1.2.0版本

wget https://libzip.org/download/libzip-1.2.0.tar.gz --no-check-certificate
tar -zxvf libzip-1.2.0.tar.gz
cd libzip-1.2.0
./configure
make && make install
cd /data/php-7.4.10/ext/zip
/alidata/server/php/bin/phpize
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig:/usr/local/jpeg-9c/lib/pkgconfig
./configure --with-php-config=/alidata/server/php/bin/php-config
make && make install
vi /alidata/server/php/etc/php.ini
extension=zip.so

问题二:图形验证码无法显示:

wget http://download-mirror.savannah.gnu.org/releases/freetype/freetype-2.10.0.tar.gz
tar -zvxf freetype-2.10.0.tar.gz
cd freetype-2.10.0
./configure --prefix=/usr/local/freetype-2.10.0
make && make install
wget http://www.ijg.org/files/jpegsrc.v9c.tar.gz
tar -zvxf jpegsrc.v9c.tar.gz
cd jpeg-9c
./configure --prefix=/usr/local/jpeg-9c
make && make install

重新安装gd扩展

cd /data/php-7.4.10/ext/gd
/alidata/server/php/bin/phpize
./configure --with-freetype=/usr/local/freetype-2.10.0 --with-jpeg=/usr/local/jpeg-9c --with-php-config=/alidata/server/php/bin/php-config
make && make install

问题三:编译时抛问题:configure: error: Package requirements (sqlite3 > 3.7.4) were not met:

处理方法:yum -y install sqlite-devel —更新版本为3.6.20,还是不行
下载sqlite3安装包:wget https://www.sqlite.org/2020/sqlite-autoconf-3330000.tar.gz
解压安装包:tar -zxvf sqlite-autoconf-3330000.tar.gz
进入安装目录:cd sqlite-autoconf-3330000
编辑命令:./configure --prefix=/usr/local
安装命令:make && make install

替换系统低版本 sqlite3

mv /usr/bin/sqlite3  /usr/bin/sqlite3_old
ln -s /usr/local/bin/sqlite3   /usr/bin/sqlite3
echo "/usr/local/lib" > /etc/ld.so.conf.d/sqlite3.conf
ldconfig
sqlite3 -version

查看版本;sqlite3 -version

问题四:提示需设置PKG_CONFIG_PATH,先查看echo $PKG_CONFIG_PATH是否有值,若有值,保留原来的值,然后加上:/usr/local/lib/pkgconfig

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig:/usr/local/jpeg-9c/lib/pkgconfig:/usr/local/freetype-2.10.0/lib/pkgconfig

问题五:编译时抛问题:configure: error: Package requirements (oniguruma) were not met:
处理方法:
下载安装包:wget https://github.com/kkos/oniguruma/archive/v6.9.4.tar.gz -O oniguruma-6.9.4.tar.gz
解压安装包: tar -zvxf oniguruma-6.9.4.tar.gz
进入安装目录:cd oniguruma-6.9.4
安装编辑:

./autogen.sh

./configure --prefix=/usr # 注意:此处安装路经不省略,若省略,php make时提示找不到该包

make && make install

执行php的make命令时,抛问题
问题六:collect2: ld returned 1 exit status
make: *** [sapi/cli/php] 错误 1
解决方案:

vi Makefile

查找 EXTRA_LIBS = ... 在结尾加上-lcrypt -liconv、保存退出
然后make clean 再编译

问题七:/data/php-7.4.10/sapi/cli/php: error while loading shared libraries: libonig.so.5: cannot open shared object file: No such file or directory
解决方案 :

yum install oniguruma - y
yum install libsodium -y

问题八:安装Memcached时,使用phpize命令时报错:
    configure.ac:3: error: Autoconf version 2.68 or higher is required
解决方案:
1)查询当前版本:
命令:

rpm -qf /usr/bin/autoconf
autoconf-2.63-5.1.el6.noarch

(2)卸载当前版本:
命令: rpm -e --nodeps autoconf-2.63
(3)安装新版本:

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

(4)查看版本:

/usr/local/autoconf/bin/autoconf -V

问题九:执行命令:/alidata/server/php/bin/phpize,抛以下错误
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
解决方案:
将生成autoconf的bin目录文件拷贝到/usr/bin目录下

cp autoconf autoconf20200910
cp /usr/local/autoconf/bin/autoconf autoconf

cp autom4te autom4te20200910
cp /usr/local/autoconf/bin/autom4te autom4te

cp autoheader autoheader20200910
cp /usr/local/autoconf/bin/autoheader autoheader

问题十:安装php抛错:error while loading shared libraries: libonig.so.5: cannot open shared object file: No such file or directory failed
解决方案:yum install libsodium -y

问题十一:SMTP邮件发送失败

cd /data/php-7.4.10/ext/sockets
/alidata/server/php/bin/phpize
./configure --with-php-config=/alidata/server/php/bin/php-config
make && make install
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值