跳转到主内容
websoft网络软件专家 - 深耕网络技术,打造实用软件!

【PHP学习第一篇】PHP+nginx+windows初尝试

【PHP学习第一篇】PHPnginxwindows初尝试 鄙人以前现在都是做的JAVA开发,公司以后要给P2PP2C系统增加社区功能,众筹系统也是PHP开发的,因此决定学习下PHP。 废话不多说,直入正题,下载: Eclipse IDE for PHP developers 4.4 nginx1.7.1 PHP5.3.5 启动 php 【PHP学习第一篇】PHP+nginx+windows初尝试 鄙人以前现在都是做的java开发,公司以后要给p2p&p2c系统增加社区功能,众筹系统也是php开发的,因此决定学习下php。 废话不多说,直入正题,下载: Eclipse IDE for PHP developers 4.4 nginx1.7.1 PHP5.3.5 立即学习 “ PHP免费学习笔记(深入) ”; 启动php-cgi脚本(start-phpcgi.bat)如下:
@echo off e: cd E:\tools\php-5.3.5 echo "php-cgi is starting on 9000 port" php-cgi.exe -b 127.0.0.1:9000
配置php.ini
nginx脚本配置
@echo off E:\tools\nginx-1.7.1\nginx.exe pause
nginx: [alert] could not open error log file: CreateFile() “logs/error.log” failed (3: The system cannot find the path specified) 2012/12/12 16:57:56 [emerg] 14312#10088: CreateFile() “C:\Users\[UserName]/conf/nginx.conf” failed (3: The system cannot find the path specified) PHP 8.5.5 PHP 8.5.5 是 PHP 8.5 分支的维护更新版本。该版本延续了“小步快跑”的迭代逻辑,通过深度错误修复、底层性能微调以及安全加固,旨在为开发者提供一个更健壮、更高效的运行环境。该版本严格遵守语义化版本规范,不包含破坏性变更。 下载 以上启动nginx脚本会报错:找不到log文件,修改如下:
@echo off e: cd E:\tools\nginx-1.7.1 echo "nginx is starting on port 80" nginx.exe pause
关闭命令行后需要打开任务管理器手动杀死nginx进程 nginx.conf文件如下:
worker_processes  1; events {     worker_connections  1024; } http {     include       mime.types;     default_type  application/octet-stream;     sendfile        on;     #日志配置-可以去掉下面这三行     log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '  '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" $http_x_forwarded_for';                access_log logs/access.log  access;     error_log logs/nginx_error.log  debug;     keepalive_timeout  65;     server {         listen   80;#nginx监听端口设置为80         server_name  localhost;         charset utf-8;#默认文件编码         location / {                             root   D:/www;#这里改成你自己的虚拟目录,注意!Nginx1.3.7及以下版本不支持文件路径中间有空格也不支持中文!!!这个以上的版本不知道会不会支持,不过这个以下是不支持的……虽然Apache支持啊……             index  index.html index.htm index.php;#注意这里添加了index.php,如果没有添加这个有可能报403错误,这个是win下的,linux或者其他系统是否会有此问题未知。             autoindex on;#如果文件不存在,列出目录树结构         }         location ~ \.php$ {             fastcgi_pass   127.0.0.1:9000;#fastcgi监听的端口,与php的cgi启动时指定的要一致             fastcgi_index  index.php;#默认首页             fastcgi_param  SCRIPT_FILENAME D:/www$fastcgi_script_name;#启动路径,这里只需要将“D:/www”这部分改为你的安装路径就可以了             include        fastcgi_params;         }     } }
启动 start-phpcgi.bat start-nginx.bat 访问:http://127.0.0.1/hello-php/hello.php

相关文章