【PHP分享】Windows本地开发环境搭建

php中文网
发布: 2016-06-23 13:48:45
原创
1018人浏览过

1. Nginx+PHP安装

  1. 下载 Nginx,安装到指定目录,如D:\nginx-1.7.5。

  2. 下载 PHP,安装到指定目录,如D:\php。注:window环境下的PHP二进制包括线程安全版本和非线程安全版本,选择相应的版本安装后独立安装的扩展包需要和其保持一致。

2. 环境配置

1).Nginx配置:

# nginx.confserver {    listen       80;    server_name  localhost;    access_log  logs/localhost.access.log;    location / {        root   D:/localhost/trunk;        index  index.html index.htm index.php;    }    error_page   500 502 503 504  /50x.html;    location = /50x.html {        root   html;    }    location ~ \.php$ {        root           D:/localhost/trunk;        fastcgi_pass   127.0.0.1:9000;        fastcgi_index  index.php;        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;        include        fastcgi_params;    }}
登录后复制

2).配置本地Host

127.0.0.1 localhost
登录后复制

3.启动/停用服务脚本

#start_service.bat@echo offREM 每个进程处理的最大请求数,或设置为 Windows 环境变量set PHP_FCGI_MAX_REQUESTS=1000echo Starting PHP FastCGI...RunHiddenConsole D:/php/php-cgi.exe -b 127.0.0.1:9000 -c D:/php/php.ini echo Starting nginx...RunHiddenConsole D:/nginx-1.7.5/nginx.exe -p D:/nginx-1.7.5
登录后复制
#stop_service.bat@echo offecho Stopping nginx...taskkill /F /IM nginx.exe > nulecho Stopping PHP FastCGI...taskkill /F /IM php-cgi.exe > nulexit
登录后复制

最后,双击start_service.bat启动相应服务。

4.访问localhost/index.php即可看到首页

PHP速学教程(入门到精通)
PHP速学教程(入门到精通)

PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!

下载
相关标签:
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号