追加CentOS 6.5的epel及remi源。php
rpm -Uvh http:
//ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rp
html
rpm -Uvh http:
//rpms.famillecollet.com/enterprise/remi-release-6.rpm
mysql
如下是CentOS 7.0的源。linux
yum install epel-releasenginx
rpm -ivh http:
//rpms.famillecollet.com/enterprise/remi-release-7.rpm
web
使用yum list命令查看可安装的包(Packege)。sql
yum list --enablerepo=remi --enablerepo=remi-php56 | grep php浏览器
yum源配置好了,下一步就安装PHP5.6。缓存
用PHP命令查看版本。php-fpm
# php --version
PHP 5.6.0 (cli) (built: Sep 3 2014 19:51:31)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans
yum install --enablerepo=remi --enablerepo=remi-php56 php-fpm
在这里安装的版本是PHP5.6.13。
从PHP5.5开始PHP代码缓存从APC变成了Zend OPcache了。
其余源:
最后,让咱们来测试下 nginx 是否能处理 PHP 页面。在测试以前,请确保重启 nginx 和 PHP-FPM。
在 CentOS 7 系统上:
在 CentOS 6 系统上:
建立一个叫名叫 test.php 的文件,而后写入以下内容,并放入 /var/www/html/ 目录。
打开浏览器,输入 http://nginx的IP地址/test.php 。
若是您能看到如上所示的页面,说明设置的 LEMP 彻底成功!