Multiple PHP versions on the same IIS server

Source: Internet
Author: User
Tags php tutorial

This article describes how to configure IIS to support multiple versions of PHP (PHP tutorial for PHP Training) on the same server (Web server training mail server training for Video server training). This is useful in a development environment where you need to test different versions of the PHP application. In addition, it is often used in production environments, where many PHP applications reside on the same server, some of which depend on a specific PHP version.

In order to install multiple versions of PHP at the same time on the same IIS server, you must manually install them according to the steps described in IIS 5.1 and IIS 6.0 and IIS 7.0 and later versions of Php.net documentation. Do not use PHP's Windows Installer because it does not support parallel installation.

After the specific PHP version follows the instructions to install, download another version of PHP, extract it to a separate directory, and configure it according to the manual installation steps. After this, follow the instructions below to configure each of the IIS servers:

· IIS 5.1

· IIS 6.0

· IIS 7.0 and later versions

Note: All the examples in the following two PHP versions are installed on the same server. PHP 5.2.11 files are located in the C: \ PHP5211 \ Directory and the PHP 5.3.1 file is located in the \ \ PHP531 \ directory.

In IIS 5.1

The FASTCGI expansion pack can be configured to the same server and site level. Since 5.1 can only have one site, it is not possible to configure it to have two versions of PHP running at the same time. However, there may be a configuration that allows easy switching from one version to another.

Open the configuration file for the IIS FastCGI extension package that is located in%windir%\system32\inetsrv\fcgiext.ini. At the end of the article there will be a section defining the FASTCGI application. It may look like this:

Type

php= php5211

[php5211]

ExePath =ç:\ php5211 \ Php-cgi.exe

Whenever A *. PHP files require IIS to be configured using PHP 5.2.11. To switch to PHP 5.3.1, add another part of the declaration, and then modify the section as follows:

Type

; php = php5211

php = php531

[php5211]

ExePath =ç:\ php5211 \ Php-gi.exe

[php531]

ExePath =ç:\ php531 \ Php-i.exe

Switch back to PHP 5.2.11 Update [Type] by commenting php= php531 and canceling php= php5211. There is no need to restart IIS after you update Fcgiexe.ini. The FASTCGI expansion pack has collected all the changes before the file is saved.

In IIS 6.0

The fastcgi in IIS 6.0 can be configured at the server level, which causes all IIS Web sites to use the same PHP version. The procedure for switching between fastcgi and PHP versions at the server level is the same as for configuring IIS 5.1.

In addition fastcgi can be configured at the site level, this will allow different websites to use different PHP versions, specify a specific PHP version of the site, please use the following command. Be sure to replace <site_id> with a real site.

cscript%windir%\system32\inetsrv\fcgiconfig.js-add-section: "php5211" ^

-extension:php-path: "C:\php5211\php-cgi.exe"-site:<site_id>

cscript%windir%\system32\inetsrv\fcgiconfig.js-add-section: "php531" ^

-extension:php-path: "C:\php531\php-cgi.exe"-site:<site_id>

After you execute these commands, open the Fcgiext.ini file in%windir%\system32\inetsrv. It should contain the following sections:

Type

php:169297538 = php5211; the actual site ID will not be the same as your site

php:273357939 = php531; the actual site ID will not be the same as your site

[php5211]

ExePath =ç:\ php5211 \ Php-cgi.exe

[php531]

ExePath =ç:\ php531 \ Php-cgi.exe

Multiple PHP versions on the same IIS server

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.