追加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 徹底成功!