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:
test_mysql.php:
四、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
總結
以上是生活随笔為你收集整理的yum安装nginx php mysql_yum安装nginx+mysql+php的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mysql5.7+proxy_mysql
- 下一篇: mysql只能查询出1000条数据_My