1.1.安装php 5.6.27
#yum install epel-release(第一次)
#rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
注: (1)rpm -ivh example.rpm 安装;(2)rpm -Uvh example.rpm 升级 example.rpm 软件包
#yum install epel-release(第二次)
#yum install -y --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof php-fpm
1.2.查看php版本
#php –v
1.3.若80端口被占用,需修改端口号
主要改httpd服务,进入/etc/httpd/conf下,找到httpd.conf 文件,打开后修改如下内容:
#Listen 12.34.56.78:80
Listen 80
把端口号80,修改为82,然后开启防火墙。
开启防火墙端口:
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload
重启服务:
#service httpd restart
1.4.php根路径确认
新建index.php文件,输入内容:
echo "<?php phpinfo(); ?>" > /home/web/index.php
将文件index.php放入/var/www/html/目录下,然后打开浏览器访问地址:http://ip:端口,
到此,php环境安装完毕。