Home >Operation and Maintenance >Windows Operation and Maintenance >The simplest and most powerful installation of multiple versions of PHP environment under win2008 iis7/iis7.5 (picture)

The simplest and most powerful installation of multiple versions of PHP environment under win2008 iis7/iis7.5 (picture)

黄舟
黄舟Original
2017-06-02 09:49:194260browse

This article mainly introduces how to install multi-version PHP environment using PHP Manager, windows 2008 R2 IIS7.5. Friends who need it can refer to

Use PHP Manager, windows 2008 R2 IIS7.5 to install multi-version PHP environment

Personal points of note in the practice of configuring and installing the PHP environment in the iis environment on Windows 2008 R2:

1. If you need to configure mysql on the server, install mysql first before configuring the php environment. (Download the corresponding mysql version according to your own needs)

Win2008 r2 installs sqlserver 2008. It should be noted that iis seems to need to install asp.net and .net components, otherwise problems may easily occur . Of course, because of the configuration problem of the server environment, you can search related error prompts. Script House has compiled relevant solutions before.

2. Download the php version file package, create a php folder under the C drive, and extract the contents of the file package to the folder. (Multiple versions of php can be stored in this folder)

3. Download and install PHP Manager. After installation, there will be more in the iis management interface. A PHP Manager management option.


You don’t need to modify the php.ini file and configure php yourself. You only need to use PHP Manager to select the required php version in php-cgi.exe It’s ok.

Please view the following content for detailed operation steps:

Method 1:

The latest debugging program must be between PHP5.2 and 5.3 After changing back and forth, and getting used to developing under Windows, I was wondering how to install multi-version support under IIS, and I suddenly discovered that Microsoft has actually prepared good tools for us.

Microsoft's support for PHP is getting stronger and stronger, which is evident in IIS7. Not only does it have strong support from FastCgi, it also adds a PHP Manager specifically for PHP management. With this stuff, installing PHP based on iis7 under windows environment is simply a piece of cake.

Although PHP5.3 has been out for a long time, many open source PHP programs do not support it very well, and PHP5.2 is still the mainstream. With the good thing PHP Manager, it is very easy to install multiple versions of PHP under iis.

The specific steps are as follows:

1. Download PHP Manager from Microsoft’s website and double-click to install it. At this time, there will be an additional PHP Manager management option in the iis management interface.

The simplest and most powerful installation of multiple versions of PHP environment under win2008 iis7/iis7.5 (picture)
The simplest and most powerful installation of multiple versions of PHP environment under win2008 iis7/iis7.5 (picture)

2. Download the windows version of the PHP program from the PHP official website. Because it runs in FastCgi mode, the latest 5.2.17 and 5.3.8 both choose to download the zip version of nts (non-threaded safety). After downloading, find a place to decompress it separately, for example, place it in the 5.2 and 5.3 directories under C:\PHP.

3. Enter the IIS management interface, double-click PHP Manager, select Register New PHP Version, a selection box will pop up, select php-cgi.exe in the 5.2 version directory File, confirm. Click Register New PHP Version again and select the php-cgi.exe file in the 5.3 version directory. After confirmation, the multi-version environment is set up. Keep it simple.

The simplest and most powerful installation of multiple versions of PHP environment under win2008 iis7/iis7.5 (picture)

Which PHP version you need to use, just click change PHP version to select the required version. To check whether the setting is correct, you can also click check phpinfo() next to it to view the corresponding PHP setting information.

The simplest and most powerful installation of multiple versions of PHP environment under win2008 iis7/iis7.5 (picture)

4. The setting of PHP in PHP Manager has also been simplified a lot. You can directly and visually manage php in PHP Setting and PHP Extension. .ini, and looking at the corresponding iis configuration, you will find that php manager has already generated the corresponding mapping for us, which is really convenient.

The simplest and most powerful installation of multiple versions of PHP environment under win2008 iis7/iis7.5 (picture)

The simplest and most powerful installation of multiple versions of PHP environment under win2008 iis7/iis7.5 (picture)

This should be the simplest and most effective way to install PHP under iis and support multiple versions!

Method 2:

First introduce the support of PHP Manager for IIS for IIS7 and 7 and above for multiple versions of PHP.

Another day I will introduce the support of URLRewrite 2.0 provided by Microsoft for IIS7 and how to extend URLRewrite.

The first step is of course to install it. Download PHP Manager for IIS and install it.

After the installation is completed, the php manager icon will appear in the IIS manager. As shown below:

#After double-clicking, the specific configuration management of php will appear.

Register the php version you want to run, find the path of the file php-cgi.exe and it is ok.

After registration, the corresponding configuration will be automatically checked. If some configurations are not consistent with the recommended configuration, the corresponding error message will be displayed. As follows:

Click "View Recommendations" to see the specific error message.

If you have registered multiple php versions, you can easily switch versions:

##The "

Check phpinfo()" next to the cut version is also something we like. It is very convenient to check the specific configuration information:

attached+

This article introduces how to configure IIS to support IIS on the same server Multiple versions of PHP. This installation is very useful in development environments where applications need to be tested with different PHP versions. Furthermore, 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 simultaneously on the same IIS server, you must install them manually by following the steps described in the php.net documentation for IIS 5.1 and IIS 6.0 and IIS 7.0 and later. Do not use PHP's Windows installer as it does not support parallel installations.

After a specific PHP version has been installed according to the instructions, download another version of PHP, extract it to a separate directory, and configure it according to the manual installation steps. After this configure each IIS server as follows:

IIS 5.1

IIS 6.0

IIS 7.0 and later

Note: Below All examples of both PHP versions are installed on the same server. The PHP 5.2.11 files are located in the C:\PHP5211\ directory and the PHP 5.3.1 files are located in the C:\PHP531\ directory.

In IIS 5.1

FastCGI extension package can be configured to the same server and website level. Because in 5.1 you can only have one website, 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 of the IIS FastCGI extension package located in %windir%\system32\inetsrv\fcgiext.ini. At the end of this article there will be a section defining FastCGI applications. It might look like this:

[类型]
PHP = php5211
[php5211] 
ExePath = C:\php5211\PHP-cgi.exe

Whenever a *.php file makes a request to configure IIS using PHP 5.2.11. To switch to PHP 5.3.1, add another section declaration and then modify the section as follows:

[类型] 
; PHP= php5211
PHP= php531
[php5211]
ExePath = C:\php5211\PHP-cgi.exe
[php531]
ExePath = C:\php531\PHP-cgi.exe

Switch back to PHP 5.2.11

Update[type] by Comments PHP = php531 and cancel PHP = php5211. There is no need to restart IIS after updating fcgiexe.ini. The FastCGI extension collects all changes before saving the file.

IIS 6.0中

在IIS 6.0的FastCGI可以配置在服务器级别,这将导致所有IIS网站使用相同的PHP版本。在服务器级别配置FastCGI和PHP版本之间切换过程和配置IIS 5.1的步骤是一样的。 

另外FastCGI可以配置在网站级别上,这将允许不同的网站使用不同的PHP版本,指定一个特定的PHP版本的网站,请使用下面的命令。请务必用真正的站点替代。

cscript %windir%\system32\inetsrv\fcgiconfig.js -add -section:"php5211" ^
-extension:php -path:"C:\php5211\php-cgi.exe" -site:
cscript %windir%\system32\inetsrv\fcgiconfig.js -add -section:"php531" ^
-extension:php -path:"C:\php531\php-cgi.exe" -site:

执行这些命令后,在%WINDIR%\system32\inetsrv打开fcgiext.ini文件。它应包含以下部分: 

 [类型]
php:169297538 = php5211           ;实际站点ID将和您的站点不一样
php:273357939 = php531             ;实际站点ID将和您的站点不一样
[php5211]
ExePath = C:\php5211\PHP-cgi.exe
[php531]
ExePath = C:\php531\PHP-cgi.exe

The above is the detailed content of The simplest and most powerful installation of multiple versions of PHP environment under win2008 iis7/iis7.5 (picture). For more information, please follow other related articles on the PHP Chinese website!

Statement:
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