【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-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)
以上启动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

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SublimeText3 Chinese version
Chinese version, very easy to use

SublimeText3 Linux new version
SublimeText3 Linux latest version

Zend Studio 13.0.1
Powerful PHP integrated development environment