中间件

PHP的简单安装

admin · 7月5日 · 2020年

1.备份repo源

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2.下载新的CentOS-Base.repo

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

3.生成缓存

yum makecache

4.安装WEBTATIC源

yum install epel-release -y
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

5.查看php版本

yum list php*

6.安装php7.2

yum install php72w -y
yum install php72w-cli php72w-common php72w-devel php72w-mysql -y                                    //常用扩展组件
yum install php72w-gd php72w-imap php72w-ldap php72w-odbc php72w-pear php72w-xml php72w-xmlrpc -y    //常用扩展组件
#nginx需要增加fpm模块
yum install php72w-fpm -y

7.确认php版本

php -v
PHP 7.2.31 (cli) (built: May 31 2020 16:18:31) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

8.查看php信息(apache)

echo "<?php phpinfo(); ?>" > /var/www/html/info.php

9.浏览器打开ip/info.php