如何在 IIS 7.5、Windows Server 2008 R2(64 位)中安装 PHP
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3444853/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to install PHP in IIS 7.5, Windows Server 2008 R2 (64bits)
提问by Toni Rosa
In http://windows.php.net/downloadsI couldn't find any x64 built for download. Further I have to choose among "Thread Safe" and "Non Thread Safe" with no explanation whether one is safer than the other or it performs better. The install.txtinside the available ZIPs for download seems out-dated an it doesn't mention anything about this.
在http://windows.php.net/downloads 中,我找不到任何专为下载而构建的 x64。此外,我必须在“线程安全”和“非线程安全”之间进行选择,而没有解释一个比另一个更安全还是性能更好。可供下载的可用 ZIP 中的install.txt似乎已经过时,它没有提及任何有关此的内容。
In http://php.net/manual/pl/install.windows.iis7.phpthey don't say a word about it either...
在http://php.net/manual/pl/install.windows.iis7.php 中,他们也只字不提...
Another doubt is once I know what to download (and why), should it be setup as a FastCGI module or as an ISAPI extension?
另一个疑问是,一旦我知道要下载什么(以及为什么),应该将其设置为 FastCGI 模块还是 ISAPI 扩展?
采纳答案by Justin
(My experiences running PHP under IIS)
(我在 IIS 下运行 PHP 的经验)
I believe that you should set up PHP as a FastCGI module - I don't think you are able to set up PHP as an ISAPI extension.You can set up PHP either using FastCGI or ISAPI - It may be that ISAPI is faster than FastCGI. There is a guide on setting up IIS using ISAPI here:
我相信您应该将 PHP 设置为 FastCGI 模块 - 我认为您无法将 PHP 设置为 ISAPI 扩展。您可以使用 FastCGI 或 ISAPI 设置 PHP - ISAPI 可能比 FastCGI 快。这里有使用 ISAPI 设置 IIS 的指南:
- http://www.lazynetworkadmin.com/knowledgebase-mainmenu-6/2-windows/141-install-php-on-server-2008-r2
- http://www.lazynetworkadmin.com/knowledgebase-mainmenu-6/2-windows/141-install-php-on-server-2008-r2
Searching google reveals a lot of pages discussing the thread safe vs non thread safe argument if you want to know the detail, however the short version is that the non thread safe version is faster, but the thread safe version is safer. You should choose the thread safe version for nowunless you have a performance problem and know that your app is going to run correctly under the non thread safe binaries.
如果你想知道细节,搜索谷歌会发现很多讨论线程安全与非线程安全参数的页面,但是简短的版本是非线程安全版本更快,但线程安全版本更安全。 您现在应该选择线程安全版本,除非您有性能问题并且知道您的应用程序将在非线程安全二进制文件下正确运行。
Finally, there isn't really any need for x64 binaries when running PHP as a FastCGI application - php runs as a separate process and so the x86 binaries will run fine on a x64 web server, and most normal php applications will have no need for an address space above 4GB as to scale IIS can simply start additional php processes.
最后,当 PHP 作为 FastCGI 应用程序运行时,实际上并不需要 x64 二进制文件 - php 作为一个单独的进程运行,因此 x86 二进制文件可以在 x64 Web 服务器上正常运行,而大多数普通的 php 应用程序不需要一个超过 4GB 的地址空间以扩展 IIS 可以简单地启动额外的 php 进程。
When configuring your FastCGI extension you need to point it at the php-cgi.exe
executable in the php installation directory.
配置 FastCGI 扩展时,您需要将其指向php-cgi.exe
php 安装目录中的可执行文件。
回答by Joe Meyer
I often use FastCGI when setting up PHP on IIS. It is moreso habit than anything else. While I did read over many of the other articles posted and it does appear that ISAPI has many advantages I thought I'd add a link to setting up FastCGI for those who want to go that route. I've used it and never had any issues with moderate request traffic.
在 IIS 上设置 PHP 时,我经常使用 FastCGI。习惯比什么都重要。虽然我确实阅读了发布的许多其他文章,而且 ISAPI 似乎确实有很多优点,但我想我会添加一个链接来为那些想要走那条路的人设置 FastCGI。我已经使用过它并且从来没有遇到过中等请求流量的问题。
Anyway here's a link to an article with screenshots on setting up PHP via FastCGI on IIS 7.5.
无论如何,这里是一篇文章的链接,其中包含有关在 IIS 7.5 上通过 FastCGI 设置 PHP 的屏幕截图。