0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
JPPINTO
  • Home
  • Certifications
  • About
  • Contact
  • Gallery
  • Current Setup
Contact

Search

March 25, 2009 / IIS 7.0, PHP, SMTP, Windows 2008

Install and Configure FastCGI & PHP 5.2.9 on (IIS 7) Windows Server 2008

In this article I will install and configure both FastCGI and PHP 5.2.9 on IIS7. You can configure PHP to use an ISAPI filter or CGI, on my old 2003 server I had it running as an ISAPI filter and it worked just fine. On my new 2008 server I am going to attempt to run the requests through Fast-CGI.exe, which should be faster than a filter.

Configuration Information

Platform: Hyper V Host (http://www.microsoft.com/windowsserver2008/en/us/hyperv.aspx)
OS: Windows Server 2008
Installation Media: PHP 5.2.9 was downloaded from http://www.php.net/downloads.php
CPU: 2 dedicated 2.0Ghz
RAM: 1024mb
Disk: 40GB
Notes: a base installation of IIS 7 has already been installed, that installation is covered here.

Installing CGI on IIS 7

You will first need to install CGI on IIS 7 before you install PHP. Installing CGI also installs FastCGI which we need for PHP to work correctly.

Open Server Manager, you can open this several different ways in Windows Server 2008. Probably the quickest way to open Server Manager is to right click "My Computer" and choose "Manage", another way is open "Control Panel" go to "Program and Features" and select "Turn Windows features on or off". A third way to open it is "Server Manager" option under Administrative Tools.

Under Roles, select "Add Roles"

Select "CGI" and press "Next"

Press "Install" to install CGI

CGI will begin its installation

After the installation succeeds, press "Close"

Under "Roles" you should now see CGI installed. Now it’s time to install PHP

Installing PHP 5.2.9

Launch "php-5.2.9-win32-installer.msi". Press "Next" to continue

Accept the terms of the license agreement by checking the checkbox, press "Next" to continue

Install PHP under C:\PHP\. You can install it under whichever directory you choose, what I have learned is C:\PHP works the best. Press "Next" to continue

Select "IIS FastCGI". Press "Next" to continue

Right click PHP and choose "Entire feature will be installed on local hard drive". It’s OK to install ALL of the extensions, we will only enable the ones we need in PHP.ini when we are done.

Press "Next" to continue

PHP is ready to install, press "Install" to begin installation

Set up will copy all the files and do what it needs to do

Do not worry about this error, IIS does not have httpd.conf file Apache does. This is probably due to the programmer drinking too much coffee

Press "Finish"

Configuring PHP 5.2.9 on IIS 7

Open PHP.ini, which is located in C:\PHP or wherever you installed PHP. You can open it with Notepad

Change "open_basedir" value to the following:

open_basedir = C:\inetpub

Go down to the extensions section, which should be at the bottom I commented out EVERY extension by adding a ; (semi-colon) in front of the extensions name. I did this for ALL of the extensions except for the following:

extension=php_curl.dll
extension=php_gd2.dll
extension=php_interbase.dll
extension=php_mbstring.dll
extension=php_mcrypt.dll
extension=php_mysql.dll

I needed to use php_mysql.dll because I am using MySQL for the database. If you are using a different DB you will need to load the appropriate DLL

Please keep in mind: IF YOU GET ERRORS (i.e. an IIS 500 error) most likely you have an extension enabled that your server does not like!

Save your PHP.ini file now

Testing PHP at the command prompt

Open a command prompt. Navigate to the directory you installed PHP to.

Type in: PHP -info and you should see a lot of scrolling and information. This means PHP is good to go.

Below is the start of the command and output, then the second picture is the last thing that will be shown.

Configuring IIS 7.0

Open IIS and click on "Handler Mappings"

Verify there is a handler mapping for *.php. 5.2.9 includes this in the installation package, before this you had to create one manually.

If you go to the properties you can see it maps *.php files to use C:\PHP\php-cgi.exe. Cool!

Testing PHP in a Browser

Navigate to the default site directory at C:\inetpub\wwwroot. Create a file called "info.php" and place the following in the file:

<div class=code>

<?php phpinfo(); ?>

</div>

Open your browser and point it at http://localhost/info.php and you should see a PHP information page similar to this:

Again, If you receive a 500 error it might be because of one of the extensions you have enabled.

Post Views: 417
<- Server Error in Ôò¼├┤Ôö£├ºÔö£ÔöÉ/’ Application on IIS 7 (allowDefinition=’MachineToApplication’)
Install CDONTS mail component and SMTP on Windows Server 2008 ->

Categories

  • Active Directory (5)
  • Amazon Cloud Services (1)
  • Blazor (1)
  • C# (C-Sharp) (3)
  • CI/CD Pipelines (1)
  • Containers (4)
  • Development (1)
  • Docker (3)
  • General (5)
  • IIS 6.0 (4)
  • IIS 7.0 (10)
  • IIS 8.0 (1)
  • Infrastructure as Code (IaC) (1)
  • Kubernetes (3)
  • MySQL (1)
  • Office 2010 (1)
  • PHP (1)
  • PowerShell (3)
  • SharePoint 2007 (8)
  • SharePoint 2010 (19)
  • SharePoint 2013 (2)
  • SMTP (4)
  • SQL Server 2008 (1)
  • SQL Server 2008 R2 (1)
  • SQL Server 2012 (2)
  • SQL Server 2019 (1)
  • Uncategorized (1)
  • URL Rewrite (2)
  • Visual Studio 2019 (1)
  • Visual Studio Code (1)
  • Windows 10 (2)
  • Windows 2003 (9)
  • Windows 2008 (18)
  • Windows 2012 (6)
  • Windows 7 (3)
  • Windows Firewall (1)
  • Windows Vista (1)

Recent Posts

  • Install Terraform on Windows
  • Create a .NET Core 3.1 Console App in Visual Studio Code
  • Install a stand-alone SQL Server 2019 Enterprise Server
  • Create a Blazor App project in Visual Studio 2019
  • Username and Password for minikube Virtual Machine

Advertisement

Tags

backconnectionhostnames custom column default gateway disappears disable shutdown event tracker error opening exe exe permissions externalize blob externalize sharepoint data facebook spam filezilla server firewall rules filazilla full installation http redirect https https redirect IIS iis7 iis 7 installation IIS installation index server configuration installing cumulative updates load balance central administration magic default gateway missing default gateway moss advanced search nlb no default gateway powershell redirect http to https search column sharepoint 2010 cumulative updates sharepoint 2010 farm build sharepoint 2010 farm configuration sharepoint 2010 farm installation sharepoint data externalization shutdown event tracker shutdown tracker SMTP storagepoint Windows 7 windows firewall configuration windows live messenger crash windows server 2008 wlbs x86
© 2026 JPPinto.com – Tech Blog. All rights reserved.