我在Windows 7(64位),PHP 5.4.12和Nginx 1.5.8上运行.
我已经阅读了许多有关设置和解决此问题的教程,这就是从本地主机请求PHP文件时,它会将其下载为文件而不显示PHP页面.以下是我的Nginx.conf文件:
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 8081;
server_name localhost;
access_log C:/Nginx/logs/access.log;
error_log C:/Nginx/logs/error.log;
root C:/Nginx/html;
fastcgi_param REDIRECT_STATUS 200;
location ~ \.PHP${
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.PHP;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
}
我正在通过命令提示符手动运行Nginx.exe.
我也尝试过先在单独的命令提示符下手动启动php-cgi.exe,如下所示:
C:\PHP5.4.12\php-cgi.exe -b 127.0.0.1:9000
我要的PHP文件在C:/ Nginx / html中,而我的要求是:
http://localhost:8081/info.PHP
<?PHP
PHPinfo();
?>
如何使我的PHP脚本在此环境中运行.有人对此有经验吗?
最佳答案
原文链接:/nginx/532242.html