cleey
望着那一丝海线,若隐若现。落日下的海霞,数不尽的美,看不完的醉
yum安装nginx+mysql+php
使用yum安装lnmp,nginx,php,mysql。这里给大家一个简单安装lnmp的方法,对于初学者来说,可以快速高效搭建一个lnmp开发环境。

目录
Nginx + MySQL + PHP安装文档
一、Install
二、Configure
1、修改nginx配置文件nginx.conf
三、Testing
1、检查php可用,建立hello.php
2、检查可连接mysql,建立test_mysql.php
3、输入网址ip/hello.php 和ip/test_mysql.php
四、Error solution
1、libprotobuf-lite.so.6 : cannot found
2、libJudy.so.1 : cannot found
3、Requires: GeoIP Requires: libGeoIP.so.1()(64bit)


环境 --> CentOS6.2 : Nginx + MySQL + PHP
‘◆’代表命令行执行

一、Install

◆wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
◆rpm -ivh nginx-release-centos-6-0.el6.ngx.noarch.rpm
◆yum install mysql mysql-server php php-mysql php-fpm nginx



二、Configure
1、修改nginx配置文件nginx.conf
◆vi /etc/nginx/nginx.conf
找到此处:这样改写

location ~ \.php$ {
set $web_root /usr/share/nginx/html;
root $web_root;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $web_root$fastcgi_script_name;
include fastcgi_params;
}



三、Testing
1、检查php可用,建立hello.php
◆vi /usr/share/nginx/html/hello.php


<?php
phpinfo();
?>


2、检查可连接mysql,建立test_mysql.php
◆vi /usr/share/nginx/html/test_mysql.php


<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{die('Could not connect: ' . mysql_error());}
mysql_select_db("mysql", $con);
$result = mysql_query("SELECT * FROM user");
while($row = mysql_fetch_array($result))
{echo $row['User'] . " " . $row['Password'];echo "<br />";}
mysql_close($con);
?>


3、输入网址ip/hello.php 和ip/test_mysql.php,查看结果
hello.php:
php
test_mysql.php:
mysql

四、Error solution
1、libprotobuf-lite.so.6 : cannot found

◆wget ftp://ftp.is.co.za/mirror/fedora.redhat.com/epel/6/x86_64/protobuf-lite-2.3.0-7.el6.x86_64.rpm
yum install protobuf-lite-2.3.0-7.el6.x86_64.rpm



2、libJudy.so.1 : cannot found

◆wget ftp://ftp.is.co.za/mirror/fedora.redhat.com/epel/6/x86_64/Judy-1.0.5-1.el6.x86_64.rpm
yum install Judy-1.0.5-1.el6.x86_64.rpm



3、Requires: GeoIP Requires: libGeoIP.so.1()(64bit)
http://pkgs.repoforge.org/geoip/

◆wget http://pkgs.repoforge.org/geoip/geoip-1.4.6-1.el6.rf.x86_64.rpm
◆rpm –ivh geoip-1.4.6-1.el6.rf.x86_64.rpm


<< 上一篇 50个良好的PHP编程习惯 PHP性能优化工具--xhprof安装 下一篇 >>
文章标签
随意 | Created At 2014 By William Clinton | 蜀ICP备14002619号-4 |