rendering site, page and component configuration...

27
Microsoft ® IIS 7.0 on Server Core Installing PHP and migrating applications Author: Craig Della Penna & Caleb Edgar Last Update: July 10, 2022 Document Location: Document Version: 1 Microsoft 7/10/2022 1

Upload: others

Post on 28-Aug-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Rendering Site, Page and Component Configuration …download.microsoft.com/.../WEB-IIS7_2/PHP_on_IIS7_a… · Web viewInstalling Fast-CGI Support15 Installing PHP on IIS 7.0:16 Testing

Microsoft®

IIS 7.0 on Server CoreInstalling PHP and migrating applicationsAuthor: Craig Della Penna & Caleb EdgarLast Update: May 25, 2023Document Location: Document Version: 1

Microsoft 5/25/2023 1

Page 2: Rendering Site, Page and Component Configuration …download.microsoft.com/.../WEB-IIS7_2/PHP_on_IIS7_a… · Web viewInstalling Fast-CGI Support15 Installing PHP on IIS 7.0:16 Testing

IIS on Server Core

The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the date of publication. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication.

This White Paper is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS DOCUMENT.

Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation.

Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property.

Unless otherwise noted, the example companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted herein are fictitious, and no association with any real company, organization, product, domain name, email address, logo, person, place, or event is intended or should be inferred.

© 2007 Microsoft Corporation. All rights reserved.

Microsoft, Active Directory, ActiveX, , Visual Basic, Windows, the Windows logo, Windows NT, Windows, Windows Server, and Windows Server System are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.

All other trademarks are property of their respective owners.

Microsoft 5/25/2023 2

Page 3: Rendering Site, Page and Component Configuration …download.microsoft.com/.../WEB-IIS7_2/PHP_on_IIS7_a… · Web viewInstalling Fast-CGI Support15 Installing PHP on IIS 7.0:16 Testing

IIS on Server Core

Contents

Introduction.................................................................................................................................................4

Overview of Server Core and IIS 7.0............................................................................................................4

Overview of Server Core..........................................................................................................................4

Benefits of a Server Core installation...................................................................................................4

Overview of IIS 7.0...................................................................................................................................5

Description and Install Instructions.............................................................................................................7

Server Core Installation...........................................................................................................................7

Prerequisites for a Server Core installation.........................................................................................7

Considerations when deploying a Server Core installation..................................................................7

Steps for manually installing a Server Core installation.......................................................................7

Configuring Server Core...........................................................................................................................8

Considerations when configuring a Server Core installation...............................................................8

Steps for configuring a Server Core installation...................................................................................8

Managing a Server Core installation......................................................................................................11

Installing IIS 7.0 on Server Core.............................................................................................................13

Prerequisites for installing IIS 7.0 on Server Core..............................................................................13

Considerations when installing IIS 7.0 on Server Core.......................................................................13

Steps for Installing IIS 7.0 on Server Core..........................................................................................14

Managing IIS 7.0 on Server Core Installations.......................................................................................15

Hosting PHP on IIS 7.0...........................................................................................................................15

Installing Fast-CGI Support................................................................................................................15

Installing PHP on IIS 7.0:....................................................................................................................16

Testing the PHP Configuration...................................................................................................................17

Installing a PHP Application on IIS 7.0................................................................................................19

Preparation........................................................................................................................................19

Installing Qdig:...................................................................................................................................19

To install QDIG:..................................................................................................................................20

Conclusion.................................................................................................................................................21

Microsoft 5/25/2023 3

Page 4: Rendering Site, Page and Component Configuration …download.microsoft.com/.../WEB-IIS7_2/PHP_on_IIS7_a… · Web viewInstalling Fast-CGI Support15 Installing PHP on IIS 7.0:16 Testing

IIS on Server Core

IntroductionThis document is to familiarize IT Professionals with the Server Core Installation of Microsoft® Windows Server® 2008 and Microsoft Internet Information Services 7.0 (IIS 7.0). The advantages of the ease of management provided by IIS 7.0 and the lower infrastructure costs brought by Server Core make it easy to migrate your PHP applications to the IIS 7.0 running on Windows Server Core environment.

The goals of this document are to describe and explain how to:

Set up the Windows Server 2008 Server Core and IIS 7.0. Install and configure PHP applications on Windows Server 2008 Server Core and IIS 7.0. Set up PHP support and migrate PHP applications on Windows Server 2008 Server Core and

IIS 7.0, and how to run PHP on IIS 7.0.

Overview of Server Core and IIS 7.0Overview of Server CoreThe Server Core installation is a new option for installing Windows Server 2008. A Server Core installation provides a minimal environment for running specific server roles, which lowers the maintenance and management requirements of the server, and significantly reduces the attack surface for those server roles. A server running Server Core supports the following server roles:

Active Directory Domain Services (AD DS) Active Directory Lightweight Directory Services (AD LDS) DHCP Server DNS Server File Services Print Services Streaming Media Services Web Server (IIS) Windows Hyper-V Server

To do this, the Server Core installation option installs only the binary files required by the supported server roles. For example, the Windows Explorer shell is not installed as part of a Server Core installation. Instead, the user interface for a server running a Server Core installation is the command prompt.

Benefits of a Server Core installationThe Server Core installation option of Windows Server 2008 provides the following benefits:

Reduced maintenance. The Server Core option installs only what is required to have a manageable server, therefore, less maintenance is required than on a full installation of Windows Server 2008.

Microsoft 5/25/2023 4

Page 5: Rendering Site, Page and Component Configuration …download.microsoft.com/.../WEB-IIS7_2/PHP_on_IIS7_a… · Web viewInstalling Fast-CGI Support15 Installing PHP on IIS 7.0:16 Testing

IIS on Server Core

Reduced attack surface. There are fewer installed components running on the server, which decreases the attack surface.

Reduced management. As fewer applications and services are installed on a server running the Server Core installation, there is less to manage.

Less disk space required. A Server Core installation requires only about 1 gigabyte (GB) of disk space to install and approximately 2 GB for operations after the installation.

SummaryThe IT administrator can customize the Server Core installation to run only the services required for that particular server. Since Server Core is modular, the specific components are more accessible, leading to a leaner, faster, better experience for the administrator.

Overview of IIS 7.0IIS 7.0 is Microsoft’s most powerful Web server ever, with new capabilities that dramatically improve the way Web solutions are developed, deployed, and managed. The modular design and extensible architecture of IIS 7.0 provides administrators and developers with a new level of control and a powerful capability to customize their Web servers. Deploying and managing Web applications on IIS 7.0 is more straightforward and efficient than ever, in addition, the powerful diagnostic and troubleshooting capabilities of IIS 7.0 make triage much faster, and reduce downtime.

The IIS 7.0 release delivers five key enhancements:

1. Modular architecture: IIS 7.0 enables the IT Professional to determine exactly which features are installed and running on the Web server. IIS 7.0 is now divided into more than 40 feature modules that can be independently installed on the server, dramatically reducing the potential attack surface, and lowering the footprint requirements of the server. Unlike previous versions, IIS 7.0 starts by installing only the essential feature modules, administrators can then add the features they want. This contrasts with the previous setup which installed everything and required the administrator to remove what they didn’t want.

2. Comprehensive extensibility APIs: IIS 7.0 enables developers to extend the Web server in an efficient way. The core Web server features of IIS 7.0 are built using a new set of public Web server APIs that all developers can use to extend, replace, or add functionality to the Web server. These APIs are available as native Win32® APIs as well as being available as managed .NET Framework APIs. Developers can also take advantage of the extensibility of event logging, configuration, and administration tool feature-sets available in IIS 7.0, providing a better experience for customers using third-party extensions.

3. Simplified, Distributed XML Configuration model: IIS 7.0 provides developers and administrators with a unified configuration system for storing all IIS and ASP.NET settings in a single XML format, This includes a set of managed code and scripting APIs which access configuration information for the entire Web platform. This new configuration system supports distributed configuration files, which can be stored along with Web site or application content.

Microsoft 5/25/2023 5

Page 6: Rendering Site, Page and Component Configuration …download.microsoft.com/.../WEB-IIS7_2/PHP_on_IIS7_a… · Web viewInstalling Fast-CGI Support15 Installing PHP on IIS 7.0:16 Testing

IIS on Server Core

These improvements have radical implications for how applications are configured and deployed. Now that Web site and application settings are no longer explicitly tied to a centralized configuration store on the local computer, configuration can simply be copied from the developer's workstation to a test server, and then to the production Web server. When a Web site is in production, administrators can share configuration information across multiple front-end Web servers, avoiding replication and manual synchronization issues.

4. Efficient Local and Remote Administration Tools: IIS 7.0 offers a broad set of administration features that simplify the day-to-day tasks of managing Web sites and applications. IIS 7.0 includes:

A new graphical user interface (GUI) administration tool IIS Manager, a new command-line utility A new managed API, a command line utility called AppCMD A new WMI provider for automating administration tasks

All of these new administration features provide unified support for managing IIS and ASP.NET settings together. The new IIS Manager in IIS 7.0 offers an improved, modular, more efficient tool for managing the Web server. IIS Manager provides support for both IIS and ASP.NET configuration settings, membership users, and role data, as well as runtime diagnostic information. The new UI also enables those who host or administer Web sites to delegate administrative control to developers or content owners, thus reducing cost of ownership and the administrative burden for the IT professional. It supports securely connecting to remote servers over HTTPS (through firewalls) and works in both dedicated and shared hosting environments.

5. Powerful diagnostic capabilities: IIS 7.0 enables developers and IT Professionals to more easily troubleshoot errant Web sites and applications. IIS 7.0 provides runtime diagnostic information to administrators—for example, what requests are currently executing, how long they have been running, which URLs they are invoking, what client called them, and what their status is. IIS 7.0 makes it possible to troubleshoot failures without having to manually reproduce them. The Failed Request Tracing feature enables server administrators to define error conditions that they wish to monitor. These diagnostic capabilities in IIS 7.0 are extensible as well, so new diagnostic events can be inserted into custom modules.

SummaryNew features in IIS 7.0 provide easy to use, flexible tools for the technical professional. Using IIS 7.0 simplifies Web server management with options that include a flexible extensibility model, powerful diagnostic tools, enhanced security, true XCopy deployment for applications, and improved administration tools. Using the delegated administration features in IIS 7.0, Web hosters can let customers or datacenters manage their own content, which helps reduce the cost of administration. Improved configuration features make it easy to create one configuration file and distribute the configuration changes to multiple servers. The new module features in IIS 7.0 can be independently installed on the server to reduce the attack surface of the server, and reduce administrative overhead where it is not needed. IIS 7.0 is designed to work with existing tools and scripts. The new management and diagnostic features in IIS 7.0 free up IT staff to work on more business-critical tasks.

Microsoft 5/25/2023 6

Page 7: Rendering Site, Page and Component Configuration …download.microsoft.com/.../WEB-IIS7_2/PHP_on_IIS7_a… · Web viewInstalling Fast-CGI Support15 Installing PHP on IIS 7.0:16 Testing

IIS on Server Core

For more information about IIS 7.0, visit the IIS Web site at: www.iis.net

Description and Install InstructionsServer Core InstallationPrerequisites for a Server Core installationTo complete this task, you will need the following:

The Windows Server 2008 installation media A valid product key A computer on which you can perform a clean Server Core installation

Considerations when deploying a Server Core installation

Only clean installations are supported.

You cannot upgrade from a previous version of the Windows Server operating system to a Server Core installation.

You cannot upgrade from a full installation of Windows Server 2008 to a Server Core installation.

You cannot upgrade from a Server Core installation to a full installation of Windows Server 2008. If you need the Windows® user interface or a server role that is not supported in a Server Core installation, you will need to install a full installation of Windows Server 2008.

Steps for manually installing a Server Core installationFollow this procedure to install a Server Core installation of Windows Server 2008.

1. Insert the Windows Server 2008 installation media into your DVD drive.

2. Select Install Language, Time/Currency Format and Input language.

3. Enter the Product Key.

4. For Product Type, select Server Core Standard.

5. For Installation Type, select Custom.

6. Select correct Install Disk.

7. Setup will begin copying files and will then restart the computer.

Microsoft 5/25/2023 7

Page 8: Rendering Site, Page and Component Configuration …download.microsoft.com/.../WEB-IIS7_2/PHP_on_IIS7_a… · Web viewInstalling Fast-CGI Support15 Installing PHP on IIS 7.0:16 Testing

IIS on Server Core

Configuring Server CoreBecause a Server Core installation does not include the Windows user interface, there is no "out-of-box experience" to help you complete the server configuration. Instead you must manually complete the configuration using the command-line tools as outlined in the following steps.

Considerations when configuring a Server Core installation

If you close all command prompts, you will not be able to manage the Server Core installation. To recover, you can press CTRL+ALT+DEL, click Start Task Manager, click File, click Run, and type cmd.exe. Alternatively, you can log off and log back on again.

Because there is no Web browser, you cannot activate a Server Core installation or access the Internet through a firewall that requires users to log on.

Steps for configuring a Server Core installationThe following procedures explain how to configure a computer running a Server Core installation. The steps include:

Setting the administrative password

Setting static IP and DNS addresses

Activating the server

Notes:A DHCP address is provided by default. You should perform this procedure only if you need to set a static IP address.There is no confirmation after installing components using pkgmgr. You can generate an 'oclist' after the install to ensure that the components are in the 'installed' category.

To set the administrative password for the first time:

1. When your computer starts for the first time after the installation completes, press CTRL+ALT+DEL. Type Administrator for the user name and leave the password blank.

2. The system will inform you that the password has expired and will prompt you for a new password.

3. Type your new password.

To set a static IP and DNS:

1. At a command prompt, type the following:

Microsoft 5/25/2023 8

Page 9: Rendering Site, Page and Component Configuration …download.microsoft.com/.../WEB-IIS7_2/PHP_on_IIS7_a… · Web viewInstalling Fast-CGI Support15 Installing PHP on IIS 7.0:16 Testing

IIS on Server Core

netsh interface ipv4 show interfaces

2. Make a note of the number shown in the Idx column of the output for your network adapter. If your computer has more than one network adapter, note the number corresponding to the network adapter for which you wish to set a static IP address.

3. At the command prompt, type:

netsh interface ipv4 set address name="<ID>" source=static address=<StaticIP> mask=<SubnetMask> gateway=<DefaultGateway>

Where:ID is the number from Step 2 aboveStaticIP is the static IP address that you are settingSubnetMask is the subnet mask for the IP addressDefaultGateway is the default gateway

4. At the command prompt, type:

netsh interface ipv4 add dnsserver name="<ID>" address=<DNSIP>index=1

Where:ID is the number from Step 2 aboveDNSIP is the IP address of your DNS server

5. Repeat Step 4 for each DNS server that you want to set, incrementing the index= number each time.

Note: If you set the static IP address on the wrong network adapter, you can change back to the DHCP address supplied by using the following command:

netsh interface ipv4 set address name="<ID>" source=dhcpWhere: ID is the number of the network adapter from Step 2 above

To change the server’s hostname:

1. Determine the current name of the server with the hostname or ipconfig command.

2. At a command prompt, type:

netdomrenamecomputer<ComputerName>/NewName:<NewComputerName>

3. Restart the computer.

Microsoft 5/25/2023 9

Page 10: Rendering Site, Page and Component Configuration …download.microsoft.com/.../WEB-IIS7_2/PHP_on_IIS7_a… · Web viewInstalling Fast-CGI Support15 Installing PHP on IIS 7.0:16 Testing

IIS on Server Core

To activate the serverAt the command prompt, type:

slmgr.vbs–ato=-

If activation is successful, no message will return in the command prompt.

Note: You can also activate by phone, by using a KMS server, or remotely by typing the following command at a command prompt of a computer that is running Windows Vista or Windows Server 2008:

cscript windows\system32\slmgr.vbs<ServerName><UserName><password>:-ato

SummaryThis new, minimalist version of Windows Server 2008 lets the IT Professional run a more secure, small-footprint server without the overhead, and the exposure, that a GUI imposes. Next we’ll take a look at managing the Server Core installation.

Microsoft 5/25/2023 10

Page 11: Rendering Site, Page and Component Configuration …download.microsoft.com/.../WEB-IIS7_2/PHP_on_IIS7_a… · Web viewInstalling Fast-CGI Support15 Installing PHP on IIS 7.0:16 Testing

IIS on Server Core

Managing a Server Core installationThe following procedures provide examples of common methods for managing a server running a Server Core installation, including:

Managing a server running a Server Core installation locally at a command prompt Managing a server running a Server Core installation remotely at a command prompt Managing a server running a Server Core installation by using Windows Remote Shell

To manage a server running a Server Core installation locally at a command prompt

1. Start a server running a Server Core installation.

2. Log on using an administrator account.

3. At the command prompt, use the applicable command-line tool for the task you want to complete.

To manage a server running a Server Core installation using a terminal server:

1. On the server running a Server Core installation, type the following command at a command prompt:cscript C:\Windows\System32\ Scregedit.wsf /ar 0

This enables the Remote Desktop for Administration mode to accept connections.2. On another computer, click Start, click Run, type mstsc, and then click OK.

3. In Computer, enter the name of the server running a Server Core installation, and click Connect.

4. Log on using an administrator account.

5. When the command prompt appears, you can manage the computer using the Windows command-line tools.

6. When you have finished remotely managing the computer, type logoff in the command prompt to end your Terminal Server session.

Notes:If you are running the Terminal Services client on a previous version of Windows, you must turn off the higher security level that is set by default in Windows Server 2008. To do this, after step 1, type the following command at the command prompt:

cscript C:\Windows\System32\Scregedit.wsf /cs 0

Microsoft 5/25/2023 11

Page 12: Rendering Site, Page and Component Configuration …download.microsoft.com/.../WEB-IIS7_2/PHP_on_IIS7_a… · Web viewInstalling Fast-CGI Support15 Installing PHP on IIS 7.0:16 Testing

IIS on Server Core

It can be useful to run Cmd.exe in a Command Prompt window on your local computer, rather than in the Terminal Services client. To do this, you need a standard Windows Server 2008 installation and the latest Terminal Services client.

To use Terminal Services RemoteApp (TS RemoteApp) to publish cmd.exe to your local computer:

1. Add the Terminal Services role to the standard Windows Server 2008 computer using Server Manager.

2. Start MMC on the standard Windows Server 2008 computer, add the TS RemoteApp snap-in, and then connect the snap-in to a server running a Server Core installation.

3. In the Action pane of the snap-in, click Add Remote Programs, and then navigate to \\<ServerName>\c$\windows\system32\cmd.exe (where ServerName is the name of the server running a Server Core installation).

4. In the Allow list, choose Remote cmd.exe, and then Create RDP package.

5. Connect to the server running a Server Core installation by using the Remote Desktop Protocol package.

To manage a server running a Server Core installation by using the Windows Remote Shell:

1. To enable Windows Remote Shell on a server running a Server Core installation, type the following command at a command prompt:WinRMquickconfig

2. On another computer, at a command prompt, use WinRS.exe to run commands on a server running a Server Core installation. For example, to perform a directory listing of the Windows folder, type:winrs -r:<ServerName> dir c:\windows

Where:ServerName is the name of the server running a Server Core installation.

Note:The WinRMquickconfig setting enables a server running a Server Core installation to accept Windows Remote Shell connections. This setting can also be set in an unattended file.

For more information about using different security credentials to run commands, see the command-line help for WinRS.exe by typing winrs -?at a command prompt.

SummaryThe Server Core installation provides the following benefits:

Microsoft 5/25/2023 12

Page 13: Rendering Site, Page and Component Configuration …download.microsoft.com/.../WEB-IIS7_2/PHP_on_IIS7_a… · Web viewInstalling Fast-CGI Support15 Installing PHP on IIS 7.0:16 Testing

IIS on Server Core

Reduced maintenance. Because the Server Core installation installs only what is required for the AD DS, AD LDS, DHCP Server, DNS Server, File Services, Print Services, and Streaming Media Services roles, much less maintenance is required.

Reduced attack surface. Because Server Core installations are minimal, fewer applications run on the server, which decreases the attack surface.

Reduced management. Because fewer applications and services are installed, there is less to manage.

Less disk space required. A Server Core installation requires only about 1 gigabyte (GB) of disk space to install and approximately 2 GB for operations after the installation.

Installing IIS 7.0 on Server Core

After the Server Core installation is complete and the server is configured, you can install one or more server roles. The Server Core installation of Windows Server 2008 supports the following server roles:

Active Directory Domain Services (AD DS) Active Directory Lightweight Directory Services (AD LDS) DHCP Server DNS Server File Services Print Services Streaming Media Services Web Server (IIS)

Prerequisites for installing IIS 7.0 on Server CoreTo complete this task, you need the following:

A computer on which you have installed and configured a Server Core installation of Windows Server 2008.

An administrator user account and password for the server running the Server Core installation.

Considerations when installing IIS 7.0 on Server CoreThe Web Server (IIS) role does not support ASP.NET in Server Core installations. Because there is no support for managed code, the following IIS features are not available in Server Core installations:

IIS-ASPNET IIS-NetFxExtensibility IIS-ManagementConsole IIS-ManagementService IIS-LegacySnapIn

Microsoft 5/25/2023 13

Page 14: Rendering Site, Page and Component Configuration …download.microsoft.com/.../WEB-IIS7_2/PHP_on_IIS7_a… · Web viewInstalling Fast-CGI Support15 Installing PHP on IIS 7.0:16 Testing

IIS on Server Core

IIS-FTPManagement WAS-NetFxEnvironment WAS-ConfigurationAPI

Steps for Installing IIS 7.0 on Server CoreTo install IIS 7.0 on a Server Core installation of Windows Server 2008, do the following.

To install the Web Server role:

1. For the default installation, type the following at a command prompt and press ENTER:

start /w pkgmgr /iu:IIS-WebServerRole;WAS-WindowsActivationService;WAS-ProcessModel

Notes: To uninstall the Web Server (IIS) role, use the following command:

start /w pkgmgr /uu:IIS-WebServerRole;WAS-WindowsActivationService;WAS-ProcessModel

This is the basic IIS 7.0 Server installation. Administrators can optimize their IIS 7.0 installation by adding additional IIS 7.0 Modules and features as needed.

For detailed IIS 7.0 module installation instructions and reference information, go to:

http://www.iis.net/articles/view.aspx/IIS7/Managing-IIS7/Configuring-the-IIS7-Runtime/Configuring-Modules/IIS7-Modules-Overview?Page=4

SummaryFeaturing modular structure and flexible installation, advanced CGI controls and config file automation, IIS 7.0 is a powerful, adaptable Web server. IIS 7.0 functionality will be enhanced as Microsoft works with Zend to improve PHP support on Windows.

Microsoft 5/25/2023 14

Page 15: Rendering Site, Page and Component Configuration …download.microsoft.com/.../WEB-IIS7_2/PHP_on_IIS7_a… · Web viewInstalling Fast-CGI Support15 Installing PHP on IIS 7.0:16 Testing

IIS on Server Core

Managing IIS 7.0 on Server Core InstallationsThere are several methods available to manage a Server Core installation, including:

Terminal Services Remote Desktop. Remote desktop can be enabled to allow you to remotely connect to the Server Core installation and manage it from the command line.

WS-Management and Windows Remote Shell. When enabled, these can be used to remotely execute command line tools and scripts on the Server Core installation.

Direct editing of ApplicationHost.config and Web.config files AppCmd locally on the server or using Terminal Services Remote Desktop. Using Windows Powershell to automate and script administration tasks.

Windows PowerShell Overview/Info/downloadhttp://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx

Windows Powershell Scripts Samples:http://www.microsoft.com/technet/scriptcenter/scripts/msh/default.mspx?mfr=true

Hosting PHP on IIS 7.0Installing Fast-CGI Support

FastCGI is a language-independent, scalable, open extension to CGI that provides high performance. The FastCGI extension is installable onto Server Core and enables application frameworks such as PHP to achieve improved performance and stability on IIS. Installing FastCGI when hosting PHP applications is very strongly recommended. In this example we will install FastCGI support to prepare the server to host our PHP application.

To install FastCGI and Static Content Web Server support, type the following text into the Server Core System's command-line

Start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;IIS-ApplicationDevelopment;IIS-CGI;IIS-HealthAndDiagnostics;IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-Security;IIS-RequestFiltering;IIS-HttpCompressionStatic;IIS-WebServerManagementTools;WAS-WindowsActivationService;WAS-ProcessModel

Microsoft 5/25/2023 15

Page 16: Rendering Site, Page and Component Configuration …download.microsoft.com/.../WEB-IIS7_2/PHP_on_IIS7_a… · Web viewInstalling Fast-CGI Support15 Installing PHP on IIS 7.0:16 Testing

IIS on Server Core

Create the PHP/FastCGI handler mapping from the command line by typing the following two AppCmd.exe commands:Notes:

1. AppCmd.exe is a new command-line tool included with IIS 7.0. AppCmd.exe can be found at %WinDir%\System32\InetSrv directory.

2. Depending on the PHP installation location, paths to executables on the hard disk may require updates. All AppCmd example commands above assume that PHP installation is in D:\PHP folder.

>AppCmd set config /section:system.webServer/fastCGI /+[fullPath='d:\php\php-cgi.exe']

>AppCmd set config /section:system.webServer/handlers /+[name='PHP-FastCGI',path='*.php',verb='*',modules='FastCgiModule',scriptProcessor='d:\php\php-cgi.exe',resourceType='Either']

Installing PHP on IIS 7.0:

1. Download the latest PHP release from the following location:

http://www.php.net/downloads.php

2. In the section titled "Windows Binaries," choose the archive with the zip extension.

Note: The Server Core lacks a GUI interface, and has no Web browser.

3. Uncompress the archive's contents to a location accessible by the Server Core system, which will likely be a network file share.

4. Create a directory on which to copy the uncompressed files, for example:

%SystemDrive%\PHP

5. Copy the entire contents of the PHP archive you uncompressed previously into

%SystemDrive%\PHP

6. Execute the following command:

rename %SystemDrive%\PHP\PHP.INI-Recommended %SystemDrive%\PHP\PHP.INI

Microsoft 5/25/2023 16

Page 17: Rendering Site, Page and Component Configuration …download.microsoft.com/.../WEB-IIS7_2/PHP_on_IIS7_a… · Web viewInstalling Fast-CGI Support15 Installing PHP on IIS 7.0:16 Testing

IIS on Server Core

Testing the PHP Configuration

1. From the command line, launch notepad.exe. In the empty file, type or paste the following text:

<?phpinfo();?>

2. Save the file as phpinfo.php to the following location:

C:\inetpub\wwwroot\

3. From a connected computer, open a browser window, and point it to:

http://%systemhost%/phpinfo.php.

4. A page displays, showing the PHP configuration.

Microsoft 5/25/2023 17

Page 18: Rendering Site, Page and Component Configuration …download.microsoft.com/.../WEB-IIS7_2/PHP_on_IIS7_a… · Web viewInstalling Fast-CGI Support15 Installing PHP on IIS 7.0:16 Testing

IIS on Server Core

Figure 1 – PHP Configuration data

SummaryIIS 7.0’s advanced standards support, support for FastCGI and command line interface provide the administrator with the best toolset available for running PHP.

Microsoft 5/25/2023 18

Page 19: Rendering Site, Page and Component Configuration …download.microsoft.com/.../WEB-IIS7_2/PHP_on_IIS7_a… · Web viewInstalling Fast-CGI Support15 Installing PHP on IIS 7.0:16 Testing

IIS on Server Core

Installing a PHP Application on IIS 7.0

The example below helps you to install Qdig, a popular, an open-source PHP-based image gallery. These steps are specific to the Qdig install and are not meant for general use.

Preparation

Open PHP.ini in notepad.exe and make the following changes:

Change The line:

 extension_dir = "./"

To the following:

extension_dir = "C:\PHP\

Change The line:

 register_long_arrays = on

To the following:

register_long_arrays = off

Add the following line to PHP.ini in the "Extensions" section:

 extension=php_gd.dll

Save the PHP.INI file and close Windows Notepad.

Installing Qdig:

Qdig is an easy-to-use PHP script that dynamically presents digital image files as an online gallery or set of galleries. Qdig supports image captions and display of EXIF image metadata. The script can generate thumbnails and smaller versions of large images such as digital camera photos.

To download and install the QDIG application, visit:

http://qdig.sourceforge.net/

Microsoft 5/25/2023 19

Page 20: Rendering Site, Page and Component Configuration …download.microsoft.com/.../WEB-IIS7_2/PHP_on_IIS7_a… · Web viewInstalling Fast-CGI Support15 Installing PHP on IIS 7.0:16 Testing

IIS on Server Core

To install QDIG:1. Unzip the contents of the QDIG application into a folder on your computer.

2. Create a directory on the Web server for the application example:

C:\inetpub\wwwroot\qdig

3. Use XCopy to copy the contents of the Qdig application archive to this directory

4. Copy several jpeg image files into the directory.

5. From a connected computer, open a browser window, and point it to:

http://%systemhost%/qdig/index.php.

You should now see the QDIG gallery and images, as below:

Figure 2

Microsoft 5/25/2023 20

Page 21: Rendering Site, Page and Component Configuration …download.microsoft.com/.../WEB-IIS7_2/PHP_on_IIS7_a… · Web viewInstalling Fast-CGI Support15 Installing PHP on IIS 7.0:16 Testing

IIS on Server Core

ConclusionThe combination of IIS 7.0 on Server Core provides IT Professionals with a lean, fast, capable command-line based Web server system that supports PHP applications and provides modern management within an enterprise-level server system. Server Core’s simplicity, small footprint, and focused capabilities make an ideal foundation for the IIS 7.0 Web server. IIS 7.0 makes Web sites and applications more secure by automatically isolating them, providing sandboxed configurations and unique process identity. IIS 7.0 also lowers costs by providing a scalable shared hosting architecture capable of hosting thousands of Web sites on a single server without sacrificing isolation or reliability.These features provide the IT community with a secure, reliable Web server toolset that integrates into the corporate enterprise environment.

Microsoft 5/25/2023 21