IIS + FastCGI + PHP5.3 + MySQL5.1 + Gzip detailed tutorial

Source: Internet
Author: User
Tags vc9 metabase


This post is completed one day and one night. Different from the general online articles, except for detailed descriptions of the entire configuration process and test process, especially in FastCGI, Microsoft's "web platform installer" is used for configuration. There is very little content on the Internet, and gzip settings are also very detailed, so you can perform graph-based operations independently. In addition, there are detailed methods and comparisons for testing the gzip compression ratio.

I have not elaborated on the theory in this article, but I have introduced the configuration process in the most detail, so that new users can configure the same environment even if they do not quite understand it, the errors and omissions in this article can also be pointed out. Let's discuss and solve the problems in the configuration.

This post aims to help new users quickly configure the IIS + FastCGI + PHP5.3 + MySQL5.1 + Gzip environment. Experts can move over. There are many images in this article, and each step has a detailed picture description, configuration is successful once as long as you do.

If you have gained some benefits after reading this article, I am very happy.

The World Cup in the morning of is not unexpected. Spain won the championship.

The following is the body and there are many images. Therefore, all the images are stored on my own website and referenced through links. Some watermarks are on it for your convenience. I hope you will forgive me.

========================================================== ====

IIS + FastCGI + PHP5.3 + MySQL5.1 + Gzip detailed configuration graphic tutorial

Name of the software used in this article and:

PHP5.3.2: php-5.3.2-nts-Win32-VC9-x86.zip



MySQL: mysql-essential-5.1.48-win32.msi



FastCGI: There are two configuration methods.

PhpMyAdmin: Version 3.3.4 is used in this document.

Zend Optimizer: The current Zend Optimizer does not support PHP5.3.2. We will reinstall it after the new version is released.

Previous words: PHP5.3 version Selection

PHP5.3 For Windows provides four versions: VC9 x86 Non Thread Safe, VC9 x86 Thread Safe, VC6 x86 Non Thread Safe, and VC6 x86 Thread Safe, refer to the English version on the left of the PHP official website to see what the differences are between these versions.

I. How to select the VC9 and VC6 versions of PHP5.3

VC6 is compiled using the Visual Studio 6 compiler. If your PHP is set up using Apache, select VC6.

VC9 is compiled using the Visual Studio 2008 compiler. If your PHP is set up using IIS, you can select VC9.

Ii. How to select the Thread Safe and Non-Thread Safe versions of PHP5.3

First, it is literally understood that Thread Safe is Thread security, and Thread security check is performed during execution, to prevent the new thread from consuming system resources by starting the CGI execution mode. Non-Thread Safe is Non-Thread security and does not perform Thread security checks during execution.

Let's take a look at two PHP Execution Methods: ISAPI and FastCGI.

The ISAPI is executed in the form of a DLL dynamic library and can be executed after a user request. After processing a user request, the ISAPI does not disappear immediately. Therefore, you need to perform a thread security check, in this way, the program execution efficiency is improved. If you use ISAPI to execute PHP, we recommend that you select the Thread Safe version;

FastCGI executes operations in a single thread, so it does not need to perform thread security checks. Apart from the thread security check protection, it can improve the execution efficiency, if you use FastCGI to execute PHP, we recommend that you select the Non-Thread Safe version.

We use IIS + FastCGI to configure the server environment, so we use the Non-Thread Safe version.

After learning how to select the PHP version, we will start the configuration process of IIS + PHP5.3 + MySQL5.1 + Gzip.

Step 1: manually configure PHP5.3



Because manual configuration is more flexible and more detailed, we will introduce manual configuration of PHP, so select to download the zip file: php-5.3.2-nts-Win32-VC9-x86.zip.

1. Decompress php-5.3.2-nts-win32-vc9-x86.zip to the installation directory, where C :\

2. Open the php-5.3.2-nts-Win32-VC9-x86 and create the php. ini file

Copy a new php. ini-development file and change the file name to phi. ini.

For example

3. Open the php. ini file and modify the extension_dir value.

Modify the value of data. timezone


Download PHP5.3.2, the latest version.


Select enable module: remove the module before it is used. Note that when you enable php_exif.dll, You must place it behind mbstring to cut php_exif.dll to php_mbstring.dll.

When FastCGI mode is configured, set cgi. force_redirect to 0 and cgi. rfc2616_headers and fastcgi. impersonate to 1.

Later, we will use the iProber probe to detect the php environment. Therefore, we must enable short_open_tag = On here. Otherwise, the "iProber. php on line 910" error will occur.

So far, some php configurations have been completed. Next we will add support for php in IIS. Of course, we adopt the FastCGI method.

Step 2: configure the FastCGI module of IIS

There are two ways to add the FastCGI module to IIS: one is to directly download the FastCGI Extension file, and the other is to use Microsoft's "web platform installer". Here we will introduce the latter.

In the first method, the name of the FastCGI Extension file is:

File Name: FastCGI Extension 1.5 for IIS 6.0 and IIS 5.1-RC (x86)

Http://www.iis.net/downloads/default.aspx? Tabid = 34 & I = 1877 & g = 6

This installer requires. net 2.0 support. Make sure that. net Framework2.0 has been installed.

Next we will introduce how to configure FastCGI using Microsoft's "web platform installer.

1. FastCGI Step 1: Open Microsoft's "web platform installer":

Http://www.microsoft.com/web/gallery/install.aspx? Appid = fastcgiiis6

Open the URL and click the button in the red box below to go to the next step.


In the displayed dialog box, click Run.

The security warning dialog box is displayed. Click run again.

Next is the download web Installer Dialog Box

After the installation program is downloaded, the web Platform is loaded.

After the installation is complete, the FastCGI installation dialog box is displayed, and click Install continue.


Next, agree to the terms, click I accept

The installation process is very fast because the file is small.

The installation will be completed later!

Finally, click exit and close IE


2. Configure in the IIS service, right-click the "website" node in IIS, and click Properties. The Properties dialog box is displayed.

Click the "home directory" tab and click "Configure ".

Click Add to add a new ISAPI

In the C: \ window \ system32 \ inetsrv directory, select fcgiext. dll



Note: Do not forget to add the. php extension here.

In the C: \ windows \ system32 \ inetsrv folder, find the fcgiext. ini file and open

Add the following configuration information at the bottom of the fcgiext. ini file:


Php = PHP


ExePath = C: \ php-5.3.2-nts-Win32-VC9-x86 \ php-cgi.exe

At this point, FastCGI configuration is complete. Let's test whether the configuration is correct and copy the iProber probe program to the web directory.

Enter http: // php In the browser. The output is as follows:





We can see the following information:

PHP run mode CGI-FCGI

PHP version 5.3.2

The FastCGI mode of IIS + PHP is successfully configured!

Note: If the following error message appears:


Error Details:

Error Number: 14001 (0x800736b1 ).

Error Description: the application cannot be started because the application configuration is incorrect. Re-installing the application may correct this problem.

HTTP Error 500-Server Error.

Internet Information Services (IIS)


Visual c ++ 2008 is not installed with the VC9 Runtime Library,

Microsoft Visual C ++ 2008 Redistributable Package (x86 ):

Http://www.microsoft.com/downloads/details.aspx? FamilyID = 9B2DA534-3E03-4391-8A4D-074B9F2BC1BF & displaylang = zh-cn


Step 3: Enable Gzip compression on IIS

The role of Gzip will not be discussed here. You can check the information.

1. Enable GZip. Step 1: Right-click "website", click "properties", click the "service" tab, select the two items in the red box, and click "OK ".

2. Right-click the Web Service Extension node under IIS and click "Add a new Web Service extension", as shown in figure

Add an extension with the extension "HTTP Compression". Note that the directory of gzip. dll is C: \ windows \ system32 \ inetsrv \ gzip. dll.

In the Web service extension of IIS, select HTTP Compression and click Allow on the left.


3. Set Gzip Parameters

To set Gzip, manually modify MetaBase in the C: \ windows \ system32 \ inetsrv directory. xml file, MetaBase. xml is very important for IIS operation. If it is damaged, IIS cannot run normally. If it is heavy, the system can be reinstalled. Therefore, you must back up the file before modifying it, the file named MetaBase_backup.xml in is a backup.

The following describes the specific deflate and gzip parameters:

Set deflate compression parameters, including the file extension, script file extension, and compression ratio. It must be noted that the compression ratio is recommended to be 1, we will discuss later which compression ratio is most suitable.

Set gzip compression parameters, including the file extension, script file extension, and compression ratio. It must be noted that the compression ratio is still recommended to be set to 1.

After the configuration is complete, start IIS to make the settings take effect.

4. If you do not want to stop IIS and directly edit the MetaBase. xml file, follow the settings:

If you do not want to stop IIS In MetaBase. xml, on the IIS node, note that IIS is not a website, right-click IIS, and click "properties"


Select "allow direct configuration database editing". Do not stop IIS from editing the MetaBase. xml file.

5. Check whether Gzip compression is enabled

If your website is published on the Internet, you can use many online detection tools. Many website administrators provide them. How can you test your website on your computer and check whether Gzip is enabled, we need some software that can capture HTTP header information. We recommend HttpAnalyzer V4. After downloading this software, we can clearly see the role of Gzip.

First, disable Gzip to see the HTTP header information when Gzip compression is not enabled in years:

As you can see, Compression Saving in is displayed as 0. We can enable Gzip Compression to check the HTTP header information again:

You can see that Content-Encoding is displayed as gzip, and Compression Saving on the right shows the Compression ratio as 73.29%, which indicates that the Compression is very effective.

With this software, you can also test the compression ratio of your website.

6. Setting the compression ratio

According to official test data, the compression ratio of KB web pages based on different gzip levels is

Gzip level 1 0.593

Gzip level 6 (default) 0.586

Gzip level 9 0.585

From this we can see that the compression efficiency after 1 is very low. Officially, this will consume server resources, so they strongly recommend setting it to 1, and gzip defaults to 6.

The actual test results of a forum are as follows:

Level 9: 88.7% compression ratio

Level 1: 86.7% compression ratio

Use my own website to test the data as follows:

The Level1 compression ratio is 62.93%, And the Level9 compression ratio is 64.30%. We can see that Level1 and Level9 are basically different.

So I suggest using 1. 9 is heavy for servers, but few people don't feel it. If there are too many people, the server load will be heavy, and the compression ratio set to 1 and 9 is not much worse.


Step 4: Install MySQL5.1

Here we will introduce MySQL 5.1.48.

The download address of MySQL is provided at the beginning of this article.

It is relatively simple to install MySQL, which is provided here.






Since ZendOptimizer does not have any php5.3 version, we cannot install it.

According to the official forum, ZendGard has to be greatly changed because of the huge changes made in php5.3. Therefore, ZendOptimizer will not be available until Gard is complete.

At this point, the complete configuration of IIS + FastCGI + PHP5.3 + MySQL + Gzip is complete.

This article has been written from the beginning to the end for two days. Due to the limited individual level, you can only write this simplest article, so you don't have to read it. I hope it will be helpful for beginners, so far, I have achieved my goal. I have not elaborated on the theory in this article, but I have introduced the configuration process in the most detail, so that new users can configure the same environment even if they do not quite understand it, the errors and omissions in this article can also be pointed out. Let's discuss and solve the problems in the configuration.

Now we have another sleep night at a.m., but I believe there are many friends like me, because this morning is the 2010 South Africa World Cup Finals! Spain VS Holland, unfortunately I am not very nice.

Welcome to my website:

Only Girl: www.vegirl.com

Java special site: www.jsfcn.com

New Titanium download site: www.ntdown.com

My mailbox: javalet@163.com

Javalet completed on

, January 1, July 12, 2010

Word documents: http://www.bkjia.com/ebook/201110/29741.html

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.