配置yum源
追加CentOS 6.5的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
安装PHP5.6
yum源配置好了,下一步就安装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
用PHP命令查看版本。
完毕!
[root@centos64 ~]# php -v
PHP 5.6.30 (cli) (built: Jan 19 2017 08:09:42)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
with Xdebug v2.5.4, Copyright (c) 2002-2017, by Derick Rethans
安装完毕后重启Apache,service httpd restart
输入命令:vi /var/www/html/test.php 在弹出的对话框里输入信息:<?php phpinfo();?>保存退出。然后通过你的浏览器输入:http://127.0.0.1/test.php如出现phpinfo界面,恭喜你php运行环境你配置成功啦