PHP installation guide in ii7

Source: Internet
Author: User

Reference:

Using FastCGI to host PHP applications on IIS 7.0

I. PHP installation

1. Download and installProgram

PHP 5.2.8 non-thread-safe zip package

The update for FastCGI Module

Administration pack for IIS 7.0

Iis7 and PHP problems in win2008

2. Configure PHP. ini

Copy c: \ PHP. ini-recommended to PhP. ini and modify the file:

FastCGI. Impersonate = 1
CGI. fix_pathinfo = 1
CGI. force_redirect = 0
Open_basedir = "G: \ projects_php"
Extension_dir = "C: \ PHP \ Ext"; extension_dir = "./"
Extension = php_mssql.dll
Extension = php_mysql.dll

Extension = php_gd2.dll
Extension = php_mbstring.dll
Extension = php_mcrypt.dll
Extension = php_pdo.dll
Extension = php_pdo_mysql.dll
Extension = php_pdo_mysql.dll

Here, open_basedir indicates the directory where the website is located. You can also specify it as "G: \", so that any website under the drive g can be within the security scope.

# To use the session, you need to add session. save_path = "C: \ PHP \ tmp" and create the directory TMP

# Extension_dir = "C: \ PHP \ Ext"

3. Configure IIS

IIS root --> handler mappings -->

Request Path: *. php
Module: fastcgimodule
Executable: "C: \ PHP \ php-cgi.exe"
Name: PhP via FastCGI

IIS root --> FastCGI settings --> edit... --> edit FastCGI Application --> instancemaxrequest = 10000

--> Environmentvariables --> php_fcgi_max_requests = 10000

4. Recommended security configurations (for reference only)

Allow_url_fopen = off
Allow_url_include = off
Register_globals = off
Open_basedir = "C:" inetpub ""
Safe_mode = off
Safe_mode_gid = off
Max_execution_time = 30
Max_input_time = 60
Memory_limit = 16 m
Upload_max_filesize = 2 m
Post_max_size = 8 m
Max_input_nesting_levels = 64
Display_errors = off
Log_errors = on
Error_log = "C:" path "of" your "choice"
FastCGI. Logging = 0
Expose_php = off

5. Independent Configuration

Reference: http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis-70/

In "per-site PHP process pools" and "specifying PHP. ini location"

A. IIS root --> FastCGI settings --> Add appliction... --> fullpath = "C: \ PHP \ php-cgi.exe"

Arguments = "-D open_basedir = G: \ projects_php \ samples \ php_hello2"

View the following configuration in c: \ windows \ system32 \ inetsrv \ config \ applicationhost. config:

< FastCGI >
  < Application Fullpath = "C: \ PHP \ php-cgi.exe" Instancemaxrequests = "10000" >
< Environmentvariables >
< Environmentvariable Name = "Php_fcgi_max_requests" Value = "10000"   />
</ Environmentvariables >
</ Application >
< Application Fullpath = "C: \ PHP \ php-cgi.exe"
Arguments = "-D open_basedir = G: \ projects_php \ samples \ php_hello2" Maxinstances = "4" Idletimeout = "300" Activitytimeout = "30" Requesttimeout = "90"

Instancemaxrequests= "200"Protocol= "Namedpipe"Queuelength= "1000"Flushnamedpipe= "False"
Rapidfailsperminute= "10" />

</FastCGI>

 

B. Modify the Web. config of the website.

<? XML version = "1.0" ?>
< Configuration >
< System. Webserver >
< Handlers Accesspolicy = "Read, script" >  
< Remove Name = "Php via FastCGI"   />
< Add Name = "Php via FastCGI" Path = "*. Php" Verb = "*" Modules = "Fastcgimodule" Scriptprocessor = "C: \ PHP \ php-cgi.exe |-D open_basedir = G: \ projects_php \ samples \ php_hello2" Resourcetype = "Unspecified" Requireaccess = "Script"   />
</ Handlers >
</ System. Webserver >
</ Configuration >

 

6. Configure Environment Variables

For example, the installation directory is in c: \ PHP

Configure the PATH variable to add c: \ PHP \;

7. Install the URL rewrite Module

Download rewrite_x86_rt1_msi

Reference: URL rewrite module using URL rewrite module configuration reference

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.