How to install and configure PHP5 using FastCgi and ISAPI methods in IIS7

Source: Internet
Author: User
Tags install php on windows vc9

When talking about the configuration and installation of the PHP environment, Apache is usually mainly equipped with PHP configuration. As the PHP version is constantly updated, the support for the Windows IIS platform is getting better and better, it is more and more convenient to configure and install the PHP environment on Windows IIS platform.

After building the Apache + PHP + Mysql environment on Windows 7, I configured and installed PHP5.2 and PHP5.3 on the Windows 7 IIS7 platform, PHP configuration methods in versions earlier than PHP5.3 on the Windows IIS platform are mainly implemented through ISAPI, while PHP5.3 supports IIS to run PHP In FastCgi mode, the configuration and installation of the two PHP5 versions are quite different. The following describes how to configure PHP on IIS by using ISAPI and FastCgi.

Preparations

Before you complete the installation and configuration of PHP5 on IIS, you first need to download PHP5.2 and PHP5.3, PHP5.3 to the php-5.3.2-Win32-VC9-x86 prevail.

Install IIS7 on Windows 7

Before installing and configuring IIS7 PHP, you must first install IIS7. IIS is not installed in Windows 7 by default. The installation process is as follows:

First, go to the control panel, click programs and functions, and then click on the left to open and close Windows functions. Check the Web core that Internet Information Services can carry and confirm the installation.

After the installation is complete, check Internet Information Service and select to install the necessary IIS functions. Note that when PHP5.2 and PHP5.3 are configured, IIS7 configures PHP using ISAPI and FastCgi, therefore, you must check Cgi and ISAPI extensions and ISAPI filters (because I configure PHP5.2 In the ISAPI mode first, I did not check Cgi ),

Install IIS7

After Windows 7 IIS7 is installed, you can see the Internet Information Service Manager option in the management tools on the control panel.

On Windows 7 IIS7, how does one configure PHP5.2 using ISAPI?

IIS7 PHP5.2 configuration Step 1: php. ini configuration

Decompress php-5.2.13-win32-vc6-x86.zip, rename it to php52iis, copy it to the C root directory, and set php. ini-list file name changed to php. ini, open php. ini configuration. Note that the directory pointing to extension_dir must be accurate, that is

Extension_dir = "C:/php52iis/ext"

In addition, the date. timezone option is not available in PHP5.2, so you do not need to set it.

Php. after ini configuration, copy it to the C: WINDOWS directory, and then copy libmcrypt under the PHP52iis directory. dll, libmysql. dll, php5ts. dll files to the C:/windows/System32 directory.

Step 2 of IIS7 PHP5.2 configuration: Configure PHP5.2 using ISAPI

Open IIS, select the ISAPI filter in the Default Web Site under the website for PHP configuration, that is

Add the ISAPI filter, select the corresponding php dll file, and then select the handler ing to add the script ing, that is

After completing the preceding PHP5 configuration for IIS7, You need to note that by default, the website under IIS7 is bound to port 80 and the website directory is % SystemDrive % inetpubwwwroot, if you have installed and configured the Apache + PHP environment before, you need to modify the default website binding port and website directory. For example, change port 80 to port 8080, and the website directory points to D: PHPWeb. Or Add a new website, that is, add an application pool and then a website.

Add application pool

Add new website

Add default document

After adding a new website, make sure there is a script ing added in the handler ing. If not, repeat the script ing operation.

Step 3 of IIS7 PHP5.2 configuration: restart the IIS7 Server

Create an index. php file in the D: php web directory. The content is as follows:

<?

Phpinfo ();

?>


Enter http: // localhost: 8080/in the browser to view the PHP5.2 configuration information.

Now, you have installed and configured PHP5.2 on Windows 7 IIS7.

On Windows 7 IIS7, how does one configure PHP5.3 in FastCgi mode?

PHP5.3 is configured in the FastCgi mode on Windows 7 IIS7, which is basically the same as PHP5.2. First extract the php-5.3.2-Win32-VC9-x86, rename it php53iis, and copy it to the C-drive root directory.

IIS7 PHP5.3 configuration Step 1: Add a website

For details about how to add IIS PHP5.2, refer to the configuration of IIS PHP5.2.

Step 2 of IIS7 PHP5.3 configuration: Add FastCgi module ing

Click "handler ing" to add a module, that is

Configure IIS to run PHP5.3 in FastCgi Mode

Step 3 of IIS7 PHP5.3 configuration: php. ini configuration

First, rename php. ini-development to php. ini and
Fastcgi. impersonate = 1 The default value is 0. If you are using IIS, You need to enable
Cgi. fix_pathinfo = 1
Cgi. force_redirect = 0 is enabled by default. If you use IIS, you can disable it.



Specify the extension_dir directory and date. timezone, that is
Extension_dir = "C:/php53iis/ext"

Date. timezone = Asia/Shanghai



Other PHP. the INI configuration is the same as the PHP5.2 configuration. The difference is that PHP is not required when you configure and install php on Windows 7 IIS7. copy ini and other files to the C:/windows and C:/windows/System32 directories. For more information, see step 4 of IIS7 PHP5.3 configuration. Restart the IIS7 server.

Access http: // localhost: 8080/at the same time.

How can the FastCGI process be unexpectedly exited?

When you use Windows 7 IIS7 for PHP configuration and installation, if the PHP configuration is incorrect, the FastCGI process will exit unexpectedly. In this case, you can use it in DOS

C: php53iisphp.exe-v

For debugging and viewing, the PHP configuration error message is usually reported. You only need to modify the relevant PHP configuration according to this information.

Now we have finished the configuration and installation of PHP5.2 and PHP5.3 on the IIS7 platform of Windows 7. It should be said that with the improvement of the PHP version, the configuration of PHP is becoming simpler and simpler.

Note: PHP website development tutorial -leapsoul.cn is copyrighted. Please indicate the original source and this statement in the form of a link during reprinting. Thank you.


Related Article

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.