简体   繁体   English

无法使用IIS7访问子目录中的PHP站点

[英]Unable to access PHP site in subdirectories using IIS7

I have IIS7 running locally on my machine, and I've installed PHP 5.6. 我在我的机器上本地运行IIS7,并且我安装了PHP 5.6。 I placed a file, phpinfo.php , in C:\\inetpub\\wwwroot\\phpinfo.php which simply contains the script <?php @phpinfo(); ?> 我在C:\\inetpub\\wwwroot\\phpinfo.php中放置了一个文件phpinfo.php<?php @phpinfo(); ?>包含脚本<?php @phpinfo(); ?> <?php @phpinfo(); ?> . <?php @phpinfo(); ?>

If I navigate to localhost/phpinfo.php I get the desired output. 如果我导航到localhost/phpinfo.php我会得到所需的输出。

I'm trying to install phpBB . 我正在尝试安装phpBB I've downloaded the files and extracted them here: C:\\inetpub\\wwwroot\\phpBB3\\ . 我已下载文件并在此处提取它们: C:\\inetpub\\wwwroot\\phpBB3\\

The install doc starts off with: 安装文档从以下开始:

Once all the files have been uploaded to your site, you should point your browser at this location with the addition of /install/. 将所有文件上传到您的网站后,您应将浏览器指向此位置并添加/ install /。 For example, if your domain name is www.example.com and you placed the phpBB files in the directory /phpBB3 off your web root you would enter http://www.example.com/phpBB3/install/ or (alternatively) http://www.example.com/phpBB3/install/index.php into your browser. 例如,如果您的域名是www.example.com,并且您将phpBB文件放在您的Web根目录/ phpBB3目录中,则输入http://www.example.com/phpBB3/install/或(或者) http ://www.example.com/phpBB3/install/index.php到您的浏览器中。 When you have done this, you should see the phpBB Introduction screen appear. 完成后,您应该会看到phpBB Introduction屏幕。

However, if I navigate to localhost/phpBB3/install or localhost/phpBB3/install/index.php I'm presented with this error: 但是,如果我导航到localhost/phpBB3/installlocalhost/phpBB3/install/index.php我会localhost/phpBB3/install/index.php此错误:

HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid. HTTP错误500.19 - 内部服务器错误无法访问请求的页面,因为页面的相关配置数据无效。

Error Code 0x8007000d 错误代码0x8007000d

Requested URL http://localhost:80/phpBB3/install/index.php 请求的URL http:// localhost:80 / phpBB3 / install / index.php

Physical Path C:\\inetpub\\wwwroot\\phpBB3\\install\\index.php 物理路径C:\\ inetpub \\ wwwroot \\ phpBB3 \\ install \\ index.php

I've confirmed the file exists: 我已经确认该文件存在:

在此输入图像描述

The only SO post I could find of value is here: https://stackoverflow.com/a/190877/1189566 and the forum linked in the answer is blocked by my work's web filters, naturally. 我能找到的唯一有价值的帖子就在这里: https//stackoverflow.com/a/190877/1189566 ,答案中链接的论坛被我作品的网页过滤器自然阻止了。

I've never had to install PHP before, so I'm sure I'm just doing something dumb with my config files but I don't know what. 我以前从来没有安装过PHP,所以我确定我只是对我的配置文件做了一些愚蠢但我不知道是什么。

These are the values I changed: fastcgi.impersonate = 1 , cgi.fix_pathinfo = 0 , cgi.force_redirect = 0 , open_basedir = C:\\inetpub\\wwwroot\\ , extension_dir = "./ext" , and I found a recommendation to comment out the doc_root setting on the Microsoft forums. 这些是我更改的值: fastcgi.impersonate = 1cgi.fix_pathinfo = 0cgi.force_redirect = 0open_basedir = C:\\inetpub\\wwwroot\\extension_dir = "./ext" ,我发现了一条评论建议在Microsoft论坛上输出doc_root设置。 That did not make a difference. 这并没有什么不同。

Any ideas as to why I can execute PHP scripts in C:\\inetpub\\wwwroot\\ but no subdirectories? 有关为什么我可以在C:\\inetpub\\wwwroot\\但没有子目录中执行PHP脚本的任何想法?

Edit; 编辑;

I found this link: https://www.iis.net/learn/application-frameworks/install-and-configure-php-applications-on-iis/using-fastcgi-to-host-php-applications-on-iis 我找到了这个链接: https//www.iis.net/learn/application-frameworks/install-and-configure-php-applications-on-iis/using-fastcgi-to-host-php-applications-on-iis

And that's pretty much what I did the first time. 这就是我第一次做的事情。 It also suggests I create that script which just calls phpinfo() , which is successful. 它还建议我创建只调用phpinfo()脚本,这是成功的。 However, it then says 然而,它然后说

NOTE: If you do not see FastCgiModule in the Modules: list, the module is either not registered or not enabled. 注意:如果在模块:列表中没有看到FastCgiModule,则模块未注册或未启用。

But this is all I see, assuming I'm looking at the right section: 但这就是我所看到的,假设我正在查看正确的部分:

在此输入图像描述

The IIS config file it mentions next located at %windir%\\windows\\system32\\config\\applicationHost.config does not exist for me. 它下面提到的IIS配置文件位于%windir%\\windows\\system32\\config\\applicationHost.config对我来说不存在。

Have you looked into the NTFS permissions on other directories? 您是否查看过其他目录的NTFS权限? I've had the exact same issue before with ASP and it would only allow me to run scripts in the wwwroot . 我之前使用ASP时遇到了完全相同的问题,它只允许我在wwwroot运行脚本。

I tried to find the same reference which helped me but found this link instead which is even better: 我试图找到相同的参考资料帮助我,但发现这个链接更好,但更好:

https://forums.iis.net/t/1200871.aspx?+php+file+on+folder+under+wwwroot+refuses+to+run https://forums.iis.net/t/1200871.aspx?+php+file+on+folder+under+wwwroot+refuses+to+run

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM