本教程操作环境:centos7系统、php7.4版、dell g3电脑
centos7本地yum怎么安装php?
centos7系统下yum安装php7版本的流程
1、安装epel和remi存储库 如果要安装php7,首先需要在centos7系统上安装并启用epel和remi存储库
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
2、安装yum-utils yum-utils 可以扩展yum的默认功能,用于管理yum存储库以及程序包,而无需进行任何手动配置,yum-utils提供的程序之一是yum-config-manager,可以使用它来启用remi存储库作为默认存储库,以安装不同的php版本。
yum install yum-utils
3、选择要安装的php7版本yum-config-manager --enable remi-php71 yum-config-manager --enable remi-php72 yum-config-manager --enable remi-php73 yum-config-manager --enable remi-php74
3.1、这里我们选择安装php74的版本yum-config-manager --enable remi-php74
4、开始安装和选择需要的扩展yum -y install php php-cli php-common php-gd php-json php-ldap php-mbstring php-mysqlnd php-pdo php-xml php-devel php-embedded php-mcrytp php-pecl-mongodb php-pecl-redis php-pecl-memcached php-opcache php-fpm php-bcmath
5、查看安装情况 5.1、php -v 查看版本[root@centos7]# php -vphp 7.4.26 (cli) (built: nov 16 2021 15:31:30) ( nts )copyright (c) the php groupzend engine v3.4.0, copyright (c) zend technologies with zend opcache v7.4.26, copyright (c), by zend technologies
5.2、管理 php-fpm 1、启动: systemctl start php-fpm
2、关闭systemctl stop php-fpm
3、查看状态systemctl status php-fpm
5.3 php -m 查看安装的扩展推荐学习:《php视频教程》
以上就是centos7本地yum怎么安装php的详细内容。