您的位置:首页 > 编程语言 > PHP开发

如何选择PHP版本?

2012-10-21 14:48 288 查看
happydagui: ISAPI是windows的东西,FastCGI在编译PHP是可选项。大部分wamp的组合,包括默认设置,都是采用php-cgi方式,因此启用的是Thread Safe模式。
从php官网下载的php版本包含thread safe和non thread safe版本的。前者php目录包含php5apache2_2.dll,后者不包含该文件。如果不采用FastCGI,都需要该文件,因此只能采用thread safe模式。如果采用FastCGI模式,需要另外下载fastcgi模块,而不再需要php5apache2_2.dll,具体配置请参考另一篇文章《在 windows 下安装 apache2.2.8+fastcgi+php  》

一、如何选择 PHP5.3 的 VC9 版本和 VC6 版本
版本是使用 Visual Studio 6 编译器编译的,如果你的 PHP 是用 Apache 来架设的,那你就选择 VC6 版本。
版本是使用 Visual Studio 2008 编译器编译的,如果你的 PHP 是用 IIS 来架设的,那你就选择 VC9 版本。

二、如何选择 PHP5.3 的 Thread Safe 和 Non Thread Safe 版本
先从字面意思上理解,Thread Safe 是线程安全,执行时会进行线程(Thread)安全检查,以防止有新要求就启动新线程的 CGI 执行方式而耗尽系统资源。Non Thread Safe 是非线程安全,在执行时不进行线程(Thread)安全检查。
再来看 PHP 的两种执行方式:ISAPI 和 FastCGI。
ISAPI 执行方式是以 DLL 动态库的形式使用,可以在被用户请求后执行,在处理完一个用户请求后不会马上消失,所以需要进行线程安全检查,这样来提高程序的执行效率,所以如果是以 ISAPI 来执行 PHP,建议选择 Thread Safe 版本。
而 FastCGI 执行方式是以单一线程来执行操作,所以不需要进行线程的安全检查,除去线程安全检查的防护反而可以提高执行效率,所以,如果是以 FastCGI 来执行 PHP,建议选择 Non Thread Safe 版本。
附一:官方原文: <http://windows.php.net/download#php-5.4-nts-VC9-x86> Which version do I choose? If you are using PHP with Apache 1 or Apache2 from apache.org you need to use the VC6 versions of PHP
If you are using PHP with IIS you should use the VC9 versions of PHP
VC6 Versions are compiled with the legacy Visual Studio 6 compiler
VC9 Versions are compiled with the Visual Studio 2008 compiler and have improvements in performance and stability. The VC9 versions require you to have the Microsoft 2008 C++ Runtime (x86) or the Microsoft 2008 C++ Runtime (x64) installed
Do NOT use VC9 version with apache.org binaries
VC9 versions of Apache can be fetched at Apache Lounge. We use their binaries to build the Apache SAPIs.
来源: <http://www.5eyi.com/how-to-choose-the-php-version/#more-461>

附二:采用标准模式以及FastCGI模式运行的PHP 前者是大多数wamp组合,包括默认设采用的方式,因此启用的是Thread Safe模式
Apache 2.0 Handler with Thread Safe enabled
CGI/FastCGI with Thread Safe disabled




内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: