Outdated: Adding PHP to IIS as CGI

This section provides a tutorial example on how to add the PHP engine to the IIS server to serve PHP scripts as Web pages.

If you want to add PHP scripts to your IIS server to serve as Web pages, you need to add the PHP engine to the IIS server as a CGI interface.

1. Add \php to the PATH environment variable. I assume you know how to do this.

2. Set up PHP configuration file. First copy \php\php.ini-recommended to \php\php.ini. Then edit \php\php.ini to set the following values:

cgi.force_redirect = 0
doc_root = "c:\inetpub\wwwroot"
cgi.redirect_status_env = ENV_VAR_NAME

3. Create a new environment variable PHPRC with \php. This is needed to access php.ini.

4. Now we need to change IIS configuration to run PHP scripts as CGI scripts. Click Control Panel, Internet Information Service (IIS), Default Web Site, and Properties. On the Directory tab, first set Execute Permissions to "Scripts only". Then click Configuration to add a new Application Mapping with Executable=\php\php-cgi.exe, Extension=.php, and Script engine checked.

5. Stop and start Default Web Site in IIS.

6. Copy Hello.php to \inetpub\wwwroot.

7. Run Internet Explorer (IE) with http://localhost/Hello.php. You should see:

Hello world!

Congratulation, you have added PHP to IIS as CGI correctly!

Last update: 2007.

Table of Contents

 About This Book

 Introduction and Installation of PHP 7.0

 PHP Script File Syntax

 PHP Data Types and Data Literals

 Variables, References, and Constants

 Expressions, Operations and Type Conversions

 Conditional Statements - "if" and "switch"

 Loop Statements - "while", "for", and "do ... while"

 Function Declaration, Arguments, and Return Values

 Arrays - Ordered Maps

 Configuring and Sending out Emails

 Retrieving Information from HTTP Requests

 Creating and Managing Sessions in PHP Scripts

 Sending and Receiving Cookies in PHP Scripts

 Controlling HTTP Response Header Lines in PHP Scripts

 MySQL Server Connection and Access Functions

 Functions to Manage Directories, Files and Images

 SOAP Extension Function and Calling Web Services

 SOAP Server Functions and Examples

 Localization Overview of Web Applications

 Using Non-ASCII Characters in HTML Documents

 Using Non-ASCII Characters as PHP Script String Literals

 Receiving Non-ASCII Characters from Input Forms

 "mbstring" Extension and Non-ASCII Encoding Management

 Managing Non-ASCII Character Strings with MySQL Servers

 Introduction of Class and Object

 Integrating PHP with Apache Web Server

Outdated Tutorials

 Outdated: Downloading and Installing PHP 5.6.6 for Windows

 Outdated: Downloading and Installing PHP 5.4.3 for Windows

 Outdated: Downloading and Installing PHP 5.2.2 for Windows

Outdated: Adding PHP to IIS as CGI

 Outdated: Downloading and Installing PHP 5.0.4 for Windows

 Outdated: Get_Temperature.php - First Example of SOAP

 Outdated: Get_Temperature_Dump.php - Dumping Debugging Information

 References

 PDF Printing Version