下載
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 出現如下界面表示成功。