Home php教程 php手册 PHP版本的区别

PHP版本的区别

Jun 06, 2016 pm 08:02 PM
php the difference Version Enter

PHP的版本,自从进入5以后,发布新版本速度明显提升很多,从PHP5.2开始,5.3 、5.4 、5.5,就快要6.0了。 注:ecshop用户请自觉使用php5.2.17版本。呵呵。 在php官网下载php时,我们会发现有vc6、vc9的区别,这是什么意思呢? VC6是legacy Visual Studio 6 c

PHP的版本,自从进入5以后,发布新版本速度明显提升很多,从PHP5.2开始,5.3 、5.4 、5.5,就快要6.0了。


注:ecshop用户请自觉使用php5.2.17版本。呵呵。


在php官网下载php时,我们会发现有vc6、vc9的区别,这是什么意思呢?


VC6是legacy Visual Studio 6 compiler,使用这个版本的编译器编译PHP代码的,使用apache做应用程序服务器,则选择vc6。

VC9是the Visual Studio 2008 compiler,就是用微软的VS编辑器编译的。使用IIS做应用程序服务器,则选择vc9。


那么,我们注意到,php-5.2.17-nts-Win32-VC6-x86.zip php的解压文件中,有nts和没有nts的区别,这个又是什么意思呢?


这要从php的5.2系列版本说起。从5.2.1版本开始,就有ts和nts的区别,Thread Safe(线程安全)和None Thread Safe(NTS,非线程安全)


Windows版的PHP从版本5.2.1开始有Thread Safe(线程安全)和None Thread Safe(NTS,非线程安全)之分,这两者不同在于何处?到底应该用哪种?这里做一个简单的介绍。


从2000年10月20日发布的第一个Windows版的PHP3.0.17开始的都是线程安全的版本,这是因为Linux/Unix系统是采用多进程的工作方式,而Windows系统是采用多线程的工作方式。如果在IIS下以CGI方式运行PHP会非常慢,因为CGI模式建立在多进程的基础之上,而不是多线程。我们在windows上会把PHP配置成以ISAPI的方式来运行,因为ISAPI是多线程的方式,这样就快多了。


但存在一个问题,很多常用的PHP扩展是以Linux/Unix的多进程思想来开发的,这些扩展在ISAPI的方式运行时就会出错,很可能将IIS进程搞崩溃,因此对于IIS来说,CGI模式才是PHP运行的最安全的方式,只不过CGI模式对于每个HTTP请求都需要重新加载和卸载整个PHP环境,其消耗是巨大的。

为了兼顾IIS下PHP的效率和安全,微软给出了FastCGI的解决方案。FastCGI可以让PHP的进程重复利用而不是每一个新的请求就重开一个进程。同时FastCGI也可以允许几个进程同时执行。这样既解决了CGI进程模式消耗太大的问题,又利用上了CGI进程模式不存在线程安全问题的优势。

因此,如果是使用ISAPI的方式来运行PHP就必须用Thread Safe(线程安全)的版本;而用FastCGI模式运行PHP的话就没有必要用线程安全检查了,用None Thread Safe(NTS,非线程安全)的版本能够更好的提高效率。


根据不同的webserver,也就是应用程序服务器,在处理应用请求的时候,有些是用多线程而非多进程的方式,那么由于线程会牵扯到共享寄存器和内存方面的,所以很容易出错(考虑c语言指针的情况),那么系统就需要时间和资源来处理寄存器中的数据,保证它们的一致性,也就是保证线程安全了。


所以是否使用Thread Safe(线程安全),主要看web server所采用的PHP请求处理方式,如果是多线程处理如IIS的ISAPI方式,那么请选择线程安全,如果是FastCGI那么选择非线程安全。


最终建议:IIS下,使用ISAPI方式运行PHP,就使用Thread Safe(线程安全)的版本,使用FastCGI方式运行PHP,就使用None Thread Safe(NTS,非线程安全)的版本。


注:php5.2没有vc9,php5.3、php5.4没有vc6。呵呵。PHP5.5开始,不支持xp和win2003了,更是vc11了,呵呵呵呵。


一般来说,我喜欢使用解压配置版本,更能了解PHP的设置和文件。有c语言基础的同仁可以下载源码看看,说不定更有所心得。


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1665
14
PHP Tutorial
1269
29
C# Tutorial
1249
24
PHP and Python: Different Paradigms Explained PHP and Python: Different Paradigms Explained Apr 18, 2025 am 12:26 AM

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

Choosing Between PHP and Python: A Guide Choosing Between PHP and Python: A Guide Apr 18, 2025 am 12:24 AM

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP and Python: A Deep Dive into Their History PHP and Python: A Deep Dive into Their History Apr 18, 2025 am 12:25 AM

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

PHP's Impact: Web Development and Beyond PHP's Impact: Web Development and Beyond Apr 18, 2025 am 12:10 AM

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

PHP vs. Python: Use Cases and Applications PHP vs. Python: Use Cases and Applications Apr 17, 2025 am 12:23 AM

PHP is suitable for web development and content management systems, and Python is suitable for data science, machine learning and automation scripts. 1.PHP performs well in building fast and scalable websites and applications and is commonly used in CMS such as WordPress. 2. Python has performed outstandingly in the fields of data science and machine learning, with rich libraries such as NumPy and TensorFlow.

The Continued Use of PHP: Reasons for Its Endurance The Continued Use of PHP: Reasons for Its Endurance Apr 19, 2025 am 12:23 AM

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

The difference between laravel and thinkphp The difference between laravel and thinkphp Apr 18, 2025 pm 01:09 PM

Laravel and ThinkPHP are both popular PHP frameworks and have their own advantages and disadvantages in development. This article will compare the two in depth, highlighting their architecture, features, and performance differences to help developers make informed choices based on their specific project needs.

The Compatibility of IIS and PHP: A Deep Dive The Compatibility of IIS and PHP: A Deep Dive Apr 22, 2025 am 12:01 AM

IIS and PHP are compatible and are implemented through FastCGI. 1.IIS forwards the .php file request to the FastCGI module through the configuration file. 2. The FastCGI module starts the PHP process to process requests to improve performance and stability. 3. In actual applications, you need to pay attention to configuration details, error debugging and performance optimization.

See all articles