yum安装nginx php mysql_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

1

2

3

4

5

◆wgethttp://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm

◆rpm-ivhnginx-release-centos-6-0.el6.ngx.noarch.rpm

◆yuminstallmysqlmysql-serverphpphp-mysqlphp-fpmnginx

二、Configure

1、修改nginx配置文件nginx.conf

◆vi /etc/nginx/nginx.conf

找到此处:这样改写

1

2

3

4

5

6

7

8

9

10

location~\.php${

set$web_root/usr/share/nginx/html;

root$web_root;

fastcgi_pass127.0.0.1:9000;

fastcgi_indexindex.php;

fastcgi_paramSCRIPT_FILENAME$web_root$fastcgi_script_name;

includefastcgi_params;

}

三、Testing

1、检查php可用,建立hello.php

◆vi /usr/share/nginx/html/hello.php

1

2

3

4

5

phpinfo();

?>

2、检查可连接mysql,建立test_mysql.php

◆vi /usr/share/nginx/html/test_mysql.php

1

2

3

4

5

6

7

8

9

10

11

12

$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"
";}

mysql_close($con);

?>

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

hello.php:

574d126f463bb7c6238c825701c08622.png

test_mysql.php:

5d288c6530ce3c843d3a14c07906b7c3.png

四、Error solution

1、libprotobuf-lite.so.6 : cannot found

1

2

3

4

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

yuminstallprotobuf-lite-2.3.0-7.el6.x86_64.rpm

2、libJudy.so.1 : cannot found

1

2

3

4

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

yuminstallJudy-1.0.5-1.el6.x86_64.rpm

3、Requires: GeoIP Requires: libGeoIP.so.1()(64bit)

http://pkgs.repoforge.org/geoip/

1

2

3

4

◆wgethttp://pkgs.repoforge.org/geoip/geoip-1.4.6-1.el6.rf.x86_64.rpm

◆rpm–ivhgeoip-1.4.6-1.el6.rf.x86_64.rpm

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值