下载
mysql-5.7.12 http://dev.mysql.com/downloads/mysql
nginx-1.10.0 http://nginx.org/en/download.html
php-5.6.21 http://php.net/downloads.php
安装
mysql安装 我安装的v6.5 百度一下就知道
nginx安装
安装基本就是毫秒级的安装完成后,在浏览器输入127.0.0.1会出现nginx的欢迎界面
nginx 的常用命令
nginx.exe -s stop //停止nginx
nginx.exe -s reload //重新加载nginx
nginx.exe -s quit //退出nginx
3. php安装
解压安装包到指定安装目录
复制 D:\services-nmp\php\php-5.6.21 目录下的php.ini-development 并重命名为php.ini
打开php.ini 修改配置
extension_dir 修改为 extension_dir = "D:/services-nmp/php/ext/" 注意斜杠 / (php的安装路径)
date.timezone 修改为 date.timezone = Asta/BeiJing
enable_dl (是否使dl()有效) 修改为 enable_dl = On
cgi.force_redirect = 1 修改为 cgi.force_redirect = 0
fastcgi.impersonate 修改为 fastcgi.impersonate = 1
cgi.rfc2616_headers 修改为 cgi.rfc2616_headers = 1
打开mysql 扩展 : 去掉 extension=php_mysql.dll extension=php_mysqli.dll 前面的分号
配置 使用nginx访问php还需需要配置nginx
打开nginx的安装目录下的conf 下的nginx.cof
修改 location / {
root html;
index index.html index.htm;
}为 location / {
root D:/services-nmp/nginx\nginx-1.10.0/html;
index index.html index.htm index.php;
}
3. 修改
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
为
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
root D:/services-nmp/nginx\nginx-1.10.0/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
4、保存配置,重启nginx
验证php是否安装成功
1、执行cgi 下载RunHiddenConsole 随便一搜就有 放到php的安装目录下然后cmd在php目录下执行如下命令
2、重启nginx
3、在nginx安装目录下的html文件夹下添加新的php程序 随便写个php程序就行
<?php
phpinfo();
?>
4、在浏览器中访问127.0.0.1/1.php 出现如下界面表示成功。
转载于:https://blog.51cto.com/10130617/1772082