现在PHP用的比较少,也可能是自己用的少,不过装个博客wordpress还是要使用PHP的,现在新版是PHP8了,CentOS默认的源,yum只能安装到5.x版本的PHP。
这里记录下yum安装PHP8的方法。
CentOS7安装PHP8
#首先安装epel、然后安装remi-release、yum-utils 配置remi-php80,最后安装PHP8一些常用的PHP组件 #如下: sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm sudo yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm sudo yum -y install yum-utils sudo yum-config-manager --disable 'remi-php*' sudo yum-config-manager --enable remi-php80 sudo yum -y install php php-{cli,fpm,mysqlnd,zip,devel,gd,mbstring,curl,xml,pear,bcmath,json} # 如下要安装其他PHP插件,例如xxx插件 sudo yum install php-xxx
CentOS8安装PHP8
和CentOS7下类似,epel和remi换成CentOS8的版本
sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm sudo dnf -y install https://rpms.remirepo.net/enterprise/remi-release-8.rpm sudo dnf -y install yum-utils sudo dnf module reset php sudo dnf module install php:remi-8.0 -y sudo dnf install php -y sudo dnf -y install php-{cli,fpm,mysqlnd,zip,devel,gd,mbstring,curl,xml,pear,bcmath,json}
检查PHP版本: php -version
[root@localhost root]# php -version PHP 8.0.11 (cli) (built: Sep 21 2021 17:07:44) ( NTS gcc x86_64 ) Copyright (c) The PHP Group Zend Engine v4.0.11, Copyright (c) Zend Technologies
文章评论