前言:
由于centos追求稳定,很多软件使用稳定的旧版,比如php,centos官方源默认为
5.4
,而php已经发展到了7.1
版,很多应用对php的要求已经高于5.4
1.[root@localhost lcr]# rpm -qa | grep php
2.php-cli-5.4.16-42.el7.x86_64
3.php-pear-1.9.4-21.el7.noarch
4.php-xml-5.4.16-42.el7.x86_64
5.php-common-5.4.16-42.el7.x86_64
6.php-process-5.4.16-42.el7.x86_64
7.php-gd-5.4.16-42.el7.x86_64
8.php-5.4.16-42.el7.x86_64
9.php-pdo-5.4.16-42.el7.x86_64
1.[root@centos-2 lcr]# yum remove php-common
CentOS/RHEL
7.x
:
1.rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
2.rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
CentOS/RHEL
6.x
:
1.rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
2.rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
安装php7.0及常用模块
1.yum install -y php70w php70w-pecl-apcu php70w-xml php70w-mcrypt php70w-gd php70w-devel php70w-mysql php70w-intl php70w-mbstring
1.[root@localhost ~]# php -v
2.PHP 7.0.22 (cli) (built: Aug 9 2017 18:23:24) ( NTS )
3.Copyright (c) 1997-2017 The PHP Group
4.Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
创建
info.php
文件
1.vi /var/www/html/info.php
输入以下内容
1. <?php
2. phpinfo()
3. ?>
重启httpd
1.service httpd restart
2.or
3.systemctl httpd restart
访问测试
浏览器访问:http://localhost/info.php or localip/info.php
至此,安装/升级完成点击回到我的主页