说明
由于机器本身是windows x64系统,所以选择了所有x64的软件;如果想选择x86也可以兼容;如果机器是x86的,那么只能选择x86的软件
下载地址
nginx
http://nginx.org/en/download.html此处选择版本 nginx/windows-1.9.4
nginx-1.9.4.zipphp非线程安全版
http://windows.php.net/download同时在页面的左侧下载相应的vc运行时,并安装此处选择 php 5.6 vc11 x64 non thread safe
php-5.6.12-nts-win32-vc11-x64.zip此处选择 vc11 x64 - visual c++ redistributable for visual studio 2012 update 4
vcredist_x64.exerunhiddenconsole
http://redmine.lighttpd.net/attachments/660/runhiddenconsole.zip
runhiddenconsole.zipmysql-installer-community
http://www.mysql.com/downloads/installer/此处选择 **
mysql-installer-community-5.6.26.0.msi需要安装.net framework 4.0.30319,已经安装有的,跳过此步) 下载地址:http://download.microsoft.com/download/9/5/a/95a9616b-7a37-4af6-bc36-d6ea96c8daae/dotnetfx40_full_x86_x64.exe
并运行其他需要在checkrequirements中需要的组件,manual的根据提示自己安装解决,auto的双击or等待软件自己下载然后安装。(提示:mysql网站都有下载)root密码为 a123456 - 可以修改这个设置,但是在下面的连接数据库的测试代码中也要相应修改另外server设置为开机自动启动安装配置 nginx、php
安装 nginx
选择软件安装目录为 c:\zjc - 这个目录可以更改解压 nginx-1.9.4.zip 到 c:\zjc\server\nginx以 c:\zjc\www 作为网站根目录
修改配置文件 c:\zjc\server\nginx\conf\nginx.conflocation / 节点下面的 root 修改为 root c:\zjc\www在 c:\zjc\www 目录下创建测试网页 index.html双击运行 :\zjc\server\nginx\nginx.exe, 浏览器打开 http://127.0.0.1,可以看到刚才创建的网页可以停止 nginx
cd c:\zjc\server\nginx
nginx.exe -s stop安装 php
解压 php-5.6.12-nts-win32-vc11-x64.zip 到 c:\zjc\server\php把 c:\zjc\server\php\php.ini-development 改名为 php.ini安装 vcredist_x64.exe
点击安装就好了
安装 runhiddenconsole
把 runhiddenconsole.zip 包中的 runhiddenconsole.exe 解压到 c:\zjc\server\utils 目录配置 nginx 、php
修改 c:\zjc\server\nginx\conf\nginx.conf
修改
#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; #}
为
location ~ \.php$ { # root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param script_filename c:/zjc/www$fastcgi_script_name; include fastcgi_params; }
启动停止脚本
c:\zjc\svr_start.bat
内容为cd server\php..\utils\runhiddenconsole.exe php-cgi.exe -b 127.0.0.1:9000 -c c:/zjc/server/php/php.inicd ..\..cd server\nginx..\utils\runhiddenconsole.exe nginx.execd ..\..
c:\zjc\svr_stop.bat
内容为taskkill /f /im nginx.exe > nultaskkill /f /im php-cgi.exe > nul
测试 nginx 、 php
创建文件 c:\zjc\www\index.php , 内容为
访问 http://127.0.0.1/index.php , 可以看到 php 相关的信息就对了
安装配置 mysql
运行 dotnetfx40_full_x86_x64.exe运行 mysql-installer-community-5.6.26.0.msi
选择 server only修改 c:\zjc\server\php\php.ini 来开启 php 对 mysql 的支持
extension_dir = ext
extension=php_mysqli.dll测试 nginx 、php、mysql
新建网页
c:\zjc\www\check_mysql.php
内容为
重启服务器
$ c:$ cd c:\zjc$ svr_stop.bat$ svr_start.bat
访问网页 http://127.0.0.1/check_mysql.php
可以看到连接成功的消息就对了
版权声明:本文为博主原创文章,未经博主允许不得转载。
以上就介绍了windows之安装nginx、php、mysql,包括了方面的内容,希望对php教程有兴趣的朋友有所帮助。