Win2008 R2 IIS7 PHP 5.4 Environment _win Server

Source: Internet
Author: User
Tags vc9 microsoft website

Author: Xiamingliang

Today's article is based on the first to find the problem, and then find a way to solve, and finally verify the situation to solve the normal way of thinking, more in line with the reality of the situation, so that everyone will look easier.

First, find the problem

Today, I want to build a small PHP web site, because I have a Windows Server 2008 R2 Server environment, and I know something about windows so I decided to use R2 IIS Server to implement the PHP site, The beginning of the Internet to check some information to see what components need to install, this step is very important, we look at some of the most information, otherwise, even if the end of everyone to achieve the purpose, it is only the article led by the nose do not know why.

The first step is to install IIS Server

The key step here is to install the CGI component () The CGI full name is a "public Gateway Interface" (Common Gateway Interface), a tool that HTTP servers "talk" to programs on your or other machines, and their programs must run on a network server. CGI can be written in any language, as long as the language has standard input, output, and environment variables. such as PHP,PERL,TCL and so on. We need to use FASTCGI to enable IIS to support PHP operations. About fastcgi is what dongdong you can find on the Internet, I link here an encyclopedia address: http://baike.baidu.cn/view/641394.htm

Installation steps I will not introduce more, put a key CGI diagram:

Note: CGI must be selected. Because my environment also needs to support other testing, so I am more irresponsible to select, we would better try to select a few components, so that their progress and the performance of the server are good.

Then, make a simple PHP page with the following code:

<?php phpinfo ();? >

The specific way is to create a TXT file, paste the code into the xxx.php, I save here for start.php

Then put the file in the root directory folder of the Web site, I use the default Web site, so the root directory in the C:\intepub\wwwroot

To set the default document for a Web site:

Set the start.php as the default document and go to the first position.

Come to the location shown below and choose Browse:

The results found that the Web page could not be browsed, prompting is not supported.

The reason for this problem is that the IIS we just built is not configured by default and will not support PHP.

Then, solve the problem.

Install Microsoft Visual C + + 2008 Redistributable Package First, this Microsoft website offers free downloads:

http://www.microsoft.com/zh-cn/download/details.aspx?id=29

Installing PHP

1. Download PHP

http://windows.php.net/download/

Today we are introducing the latest for Windows version.

VC9 x86 non Thread Safe

How to choose a version of PHP

The VC6 version is compiled using the visual Studio 6 compiler, and if your PHP is built with Apache, select the VC6 version.

The VC9 version is compiled using the visual Studio 2008 compiler, and if your PHP is set up with IIS, choose VC9

Two. how to select the thread safe and non thread safe version

Thread safe is threaded, and thread safety monitoring is performed to prevent new requirements from running out of system resources in the form of CGI execution that starts a new thread. Non thread safety is not thread safe and does not perform thread security checks at execution time.

PHP two ways to do this: ISAPI and fastcgi.

ISAPI execution is in the form of DLL dynamic library, can be executed after the user request, after processing a user request will not disappear immediately, so the need for thread security checks, so as to improve the efficiency of program execution, so if you are using ISAPI to execute PHP, it is recommended to select thread Safe version;

and fastcgi execution is a single thread to perform operations, so no need for thread security checks, go out thread security check protection can improve efficiency, so, if it is to fastcgi to execute PHP, it is recommended to choose non Thread safe version;

2. Unzip and put the extracted files in the customized installation directory

3. Modify php.ini file (renamed by Copy php.ini-production)

4. See annex for Change point

1extension_dir = "< your PHP installer installation path >"

2 Set the time zone to prevent unexpected errors from occurring.

3 set the. dll file to cancel the ";" in front of it.

Note: The Extension=php_exif.dll must be placed behind the extension=php_mbstring.dll.

4fastcgi.impersonate = 1

Cgi.rfc2616_headers = 1

5cgi.force_redirect = 0

6short_open_tag = On

5. Configure IIS to "process application mappings"

Add a module map

6. Restart IIS, browse.



More server-related software can be downloaded to the s.jb51.net.

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.