您现在的位置是:网站首页 > 学无止境
linux系统centos下yum升级php5,php7,php8
linux系统centos7下yum升级php5.3,php5.4,php5.5,php5.6,php7.0,php7.1,php7.2,php7.3,php7.4,php8.0,php8.1,php8.2,php8.3版本
yum update #更新现有的软件包
yum upgrade #升级所有的软件包
yum install yum-utils #安装yum-utils工具,可以显示可用yum源
yum install epel-release #安装epel-release源,可以获取额外的软件包
yum install https://mirrors.aliyun.com/remi/enterprise/remi-release-7.rpm
yum install https://mirrors.aliyun.com/remi/enterprise/remi-release-8.rpm
php -v #查看当前系统中PHP版本号
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm #添加一个新的yum源
yum -y remove php* #卸载原有PHP
#安装PHP8.3版本
yum -y install −−enablerepo=remi-php83 php83 php83-php php83-php-xml php83-php-xmlrpc php83-php-pecl-mcrypt php83-php-fpm php83-php-pecl-apcu php83-php-mbstring php83-php-gd php83-php-json php83-php-pecl-json-post php83-php-pdo php83-php-mysqlnd php83-php-pecl-mysql php83-php-opcache php83-php-pear php83-php-soap php83-php-intl php83-php-pear
#安装PHP7.3版本
yum install -y php73-php-fpm php73-php-cli php73-php-bcmath php73-php-gd php73-php-json php73-php-mbstring php73-php-mcrypt php73-php-mysqlnd php73-php-opcache php73-php-pdo php73-php-pecl-crypto php73-php-pecl-mcrypt php73-php-pecl-geoip php73-php-recode php73-php-snmp php73-php-soap php73-php-xml
yum list installed | grep php #查看yum源中PHP信息
ln -sf /usr/bin/php83 /usr/bin/php #使用命令ln -sf切换PHP版本
ln -sf /usr/bin/php73 /usr/bin/php #使用命令ln -sf切换PHP版本
systemctl start php83-php-fpm #重启PHP服务