搭建Lamp之安装PHP5.6

笔者环境:CentOS6.9,不知为毛,笔者的centOS6.9直接安装php5.6后,能查到版本号,但是访问PHP页面时无反应。采用的办法是先用yum安装php5.3,然后卸载,再安装PHP5.6则没有这种问题
Centos7则没有上述问题问题。

1、安装PHP5.3

#yum install php

2、卸载php5.3

#yum -y remove php*

3、配置yum源

CentOS 6的epel及remi源
# rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
CentOS7的源
# yum install epel-release
# rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
image.png

4、安装php5.6

# yum install --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

image.png
出现Is this ok 输入y直接回车
image.png

5、查看php版本

#php -v
image.png

6、测试

在apache配置的目录下:(默认为/var/www/html)新建test.php
#touch test.php
使用vim命令添加内容
#vim test.php
添加phpinfo();
重启apache
#service httpd restart
输入:ip:端口/test.php出现以下界面则安装成功。
image.png

posted @ 2017-12-08 17:05  吴永生  阅读(891)  评论(0编辑  收藏  举报