Windows Server 2008 Configuration iis+php

Source: Internet
Author: User
Tags php website microsoft download center

Problem:

Recently to go online a php-written MVC project, found that Windows Server 2008 is installed or PHP5.2, a lot of syntax is not supported.

Try some of the solutions:

1. Upgrade PHP to 5.6, but you need to do IIS and PHP configuration, because IIS also undertakes several other Web projects to run, so this is the most secure solution.

2. Install Apache or nginx on Windows Server 2008, because Apache or Nginx and PHP are better, but Apache does not perform well on Windows Server 2008, Another drawback of this scheme is the need to configure subdomains, etc., which have not been studied before, so this option is optional.

Final Solution:

1. Before installing PHP5.6, check to see if there is a Visual C + + 2012 Runtime Environment (release package). If not, download the installation in Microsoft Download Center first.

Download link available here: x86 version, x64 version

2. Download PHP5.6 on the PHP website, unzip to any folder of any drive, of course, if you want to "steal a lazy" in the IIS configuration, you can change the original PHP folder to PHP5.2, the PHP5.6 to PHP, to replace the original path.

Next is a few more complicated steps, please sit tight, we have to speed up ~

3. In php.ini, modify or make sure that you have the following configurations:

Cgi.force_redirect = 0

The configured comment is written on:

Cgi.force_redirect is necessary to provide security running PHP as a CGI under most Web servers. Left undefined, PHP turns this on by default. You can turn it off here at YOUR OWN RISK. You CAN safely turn this off for IIS, in fact, you must.

In fact, the intention is to provide a secure CGI, but under IIS, you still have to turn TA off.

Cgi.fix_pathinfo=1

The configured comment is written on:

Cgi.fix_pathinfo provides *real* path_info/path_translated support for CGI. PHP ' s previous behaviour was to set path_translated to Script_filename, and to not grok what Path_info is. For more information in Path_info, see the CGI specs. Setting this to 1 would cause PHP CGI to fix their paths to conform to the spec. A setting of zero causes PHP to behave as before. Default is 1. You should fix your scripts to use Script_filename rather than path_translated.

There is no IIS, so it is set to 1.

Fastcgi.impersonate = 1

The configured comment is written on:

FastCGI under IIS (on WINNT based OS) supports the ability to impersonate security tokens of the calling client. This allows IIS to define the security context, the request runs under. mod_fastcgi under Apache does not currently support this feature (03/17/2002)

Set to 1 if running under IIS. Default is zero.

Here the comments, the pits are explained clearly, under IIS, let you set to 1 should be set to 1.

Date.timezone = Asia/shanghai

The time zone is set to Asia Shanghai, but in fact this configuration seems to work only if you use the Phpinfo () function to view the PHP version, you really need to use the time zone to write a statement in the project can also, has been pro-test.

4. Adding program mappings in IIS

This step is not difficult to understand, is to let all the PHP files are executed with CGI, so the php-cgi.exe this executable file path to fill in it.

Originally in the ISAPI restrictions and CGI restrictions have the original PHP5.2 terms, because PHP5.2 and PHP5.6 different, version 5.6 has not php5isapi.dll this file, that is, 5.6 has discarded the DLL and the CGI executable file, so you can delete this or set to "Not allowed." If you want to fill out the path of php-cgi.exe, remember to enclose the quotation marks.

At this point, you can already see this familiar page in the browser.

Summarize:

In fact, we would have to give up this program, because at noon by a 500 status code to get burned, do not know where the problem, and then appeared php-cgi.exe-fastcgi process unexpectedly exit and Unable to locate the program input point Php5ts.dll such a mistake, then I directly ran the php-cgi.exe, found that the path appears on the command line is not PHP5.6 folder path, only to find the problem. So I directly named the PHP5.6 folder as the original PHP folder name, the problem solved successfully. But the problem is gone, seems to have left a doubt, what is the missing step? You will still experience this problem if IIS configures PHP from zero at a later time.

Windows Server 2008 Configuration iis+php

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.