php on iis7 and server core.doc

Upload: rio-andrianto

Post on 14-Apr-2018

257 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/27/2019 PHP on IIS7 and Server Core.doc

    1/23

    Microsoft

    IIS 7.0 on Server Core

    Installing PHP and migrating applications

    Author: Craig Della Penna & Caleb EdgarLast Update: October 26, 2013

    Microsoft 10/26/2013 1

  • 7/27/2019 PHP on IIS7 and Server Core.doc

    2/23

    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 10/26/2013 2

  • 7/27/2019 PHP on IIS7 and Server Core.doc

    3/23

    IIS on Server Core

    Contents

    Contents................................................................................................................................... 3

    Introduction................................................................................................................5

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

    Overview of Server Core..........................................................................................5

    Benefits of a Server Core installation...................................................................6

    Overview of IIS 7.0 .................................................................................................6

    Description and Install Instructions............................................................................8

    Server Core Installation...........................................................................................8

    Prerequisites for a Server Core installation..........................................................8

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

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

    ................................................................................................................................ 9

    Configuring Server Core.......................................................................................... 9

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

    Steps for configuring a Server Core installation...................................................9Managing a Server Core installation......................................................................12

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

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

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

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

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

    Hosting PHP on IIS 7.0 .......................................................................................... 17

    Installing Fast-CGI Support.................................................................................17

    Installing PHP on IIS 7.0:.....................................................................................18

    Testing the PHP Configuration ................................................................................19

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

    Preparation.........................................................................................................21

    Installing Qdig: .................................................................................................. 21

    To install QDIG:.................................................................................................. 22

    Microsoft 10/26/2013 3

  • 7/27/2019 PHP on IIS7 and Server Core.doc

    4/23

    IIS on Server Core

    Conclusion................................................................................................................ 23

    Microsoft 10/26/2013 4

  • 7/27/2019 PHP on IIS7 and Server Core.doc

    5/23

    IIS on Server Core

    IntroductionThis document is to familiarize IT Professionals with the Server Core Installation ofMicrosoft 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 thelower infrastructure costs brought by Server Core make it easy to migrate your PHPapplications 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.0

    Overview of Server Core

    The Server Core installation is a new option for installing Windows Server 2008. AServer Core installation provides a minimal environment for running specific serverroles, which lowers the maintenance and management requirements of the server,and significantly reduces the attack surface for those server roles. A server runningServer 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 requiredby the supported server roles. For example, the Windows Explorer shell is notinstalled as part of a Server Core installation. Instead, the user interface for a serverrunning a Server Core installation is the command prompt.

    Microsoft 10/26/2013 5

  • 7/27/2019 PHP on IIS7 and Server Core.doc

    6/23

    IIS on Server Core

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

    Reduced maintenance.The Server Core option installs only what is required tohave a manageable server, therefore, less maintenance is required than on a fullinstallation of Windows Server 2008.

    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 aserver 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 operationsafter the installation.

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

    Overview of IIS 7.0

    IIS 7.0 is Microsofts most powerful Web server ever, with new capabilities thatdramatically improve the way Web solutions are developed, deployed, and

    managed. The modular design and extensible architecture of IIS 7.0 providesadministrators and developers with a new level of control and a powerful capabilityto customize their Web servers. Deploying and managing Web applications onIIS 7.0 is more straightforward and efficient than ever, in addition, the powerfuldiagnostic and troubleshooting capabilities of IIS 7.0 make triage much faster, andreduce downtime.

    The IIS 7.0 release delivers five key enhancements:

    1. Modular architecture: IIS 7.0 enables the IT Professional to determineexactly which features are installed and running on the Web server. IIS 7.0 isnow 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 previousversions, IIS 7.0 starts by installing only the essential feature modules,administrators can then add the features they want. This contrasts with theprevious setup which installed everything and required the administrator toremove what they didnt want.

    2. Comprehensive extensibility APIs: IIS 7.0 enables developers to extendthe Web server in an efficient way. The core Web server features of IIS 7.0

    Microsoft 10/26/2013 6

  • 7/27/2019 PHP on IIS7 and Server Core.doc

    7/23

    IIS on Server Core

    are built using a new set of public Web server APIs that all developers canuse to extend, replace, or add functionality to the Web server. These APIs areavailable as native Win32 APIs as well as being available as managed .NETFramework APIs. Developers can also take advantage of the extensibility ofevent logging, configuration, and administration tool feature-sets available in

    IIS 7.0, providing a better experience for customers using third-partyextensions.

    3. Simplified, Distributed XML Configuration model: IIS 7.0 providesdevelopers and administrators with a unified configuration system for storingall IIS and ASP.NET settings in a single XML format, This includes a set ofmanaged code and scripting APIs which access configuration information forthe entire Web platform. This new configuration system supports distributedconfiguration files, which can be stored along with Web site or applicationcontent.

    These improvements have radical implications for how applications areconfigured and deployed. Now that Web site and application settings are no

    longer explicitly tied to a centralized configuration store on the localcomputer, configuration can simply be copied from the developer'sworkstation to a test server, and then to the production Web server. When aWeb site is in production, administrators can share configuration informationacross multiple front-end Web servers, avoiding replication and manualsynchronization issues.

    4. Efficient Local and Remote Administration Tools: IIS 7.0 offers a broadset of administration features that simplify the day-to-day tasks of managingWeb 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 managingIIS and ASP.NET settings together.

    The new IIS Manager in IIS 7.0 offers an improved, modular, more efficienttool for managing the Web server. IIS Manager provides support for both IISand ASP.NET configuration settings, membership users, and role data, as wellas runtime diagnostic information. The new UI also enables those who host oradminister Web sites to delegate administrative control to developers orcontent owners, thus reducing cost of ownership and the administrative

    burden for the IT professional. It supports securely connecting to remoteservers over HTTPS (through firewalls) and works in both dedicated andshared hosting environments.

    5. Powerful diagnostic capabilities: IIS 7.0 enables developers and ITProfessionals to more easily troubleshoot errant Web sites and applications.IIS 7.0 provides runtime diagnostic information to administratorsforexample, what requests are currently executing, how long they have beenrunning, which URLs they are invoking, what client called them, and what

    Microsoft 10/26/2013 7

  • 7/27/2019 PHP on IIS7 and Server Core.doc

    8/23

    IIS on Server Core

    their status is. IIS 7.0 makes it possible to troubleshoot failures withouthaving to manually reproduce them. The Failed Request Tracing featureenables server administrators to define error conditions that they wish tomonitor. These diagnostic capabilities in IIS 7.0 are extensible as well, so newdiagnostic events can be inserted into custom modules.

    SummaryNew features in IIS 7.0 provide easy to use, flexible tools for the technicalprofessional. Using IIS 7.0 simplifies Web server management with optionsthat include a flexible extensibility model, powerful diagnostic tools,enhanced security, true XCopy deployment for applications, and improvedadministration 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 configurationfeatures make it easy to create one configuration file and distribute theconfiguration changes to multiple servers. The new module features in IIS 7.0can be independently installed on the server to reduce the attack surface of

    the server, and reduce administrative overhead where it is not needed. IIS7.0 is designed to work with existing tools and scripts. The new managementand diagnostic features in IIS 7.0 free up IT staff to work on more business-critical tasks.

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

    Description and Install Instructions

    Server Core Installation

    Prerequisites 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.

    Microsoft 10/26/2013 8

    http://www.iis.net/http://www.iis.net/
  • 7/27/2019 PHP on IIS7 and Server Core.doc

    9/23

    IIS on Server Core

    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 serverrole that is not supported in a Server Core installation, you will need to installa 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.

    Configuring Server Core

    Because 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-linetools 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 StartTask Manager, click File, click Run, and type cmd.exe. Alternatively, youcan 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 logon.

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

    Setting the administrative password

    Microsoft 10/26/2013 9

  • 7/27/2019 PHP on IIS7 and Server Core.doc

    10/23

    IIS on Server Core

    Setting static IP and DNS addresses

    Activating the server

    Notes:A DHCP address is provided by default. You should perform this procedure only ifyou need to set a static IP address.

    There is no confirmation after installing components using pkgmgr. You cangenerate 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 installationcompletes, press CTRL+ALT+DEL. Type Administrator for the username and leave the password blank.

    2. The system will inform you that the password has expired and willprompt 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:

    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, notethe number corresponding to the network adapter for which you wish to seta static IP address.

    3. At the command prompt, type:

    netsh interface ipv4 set address name="" source=static

    address= mask= gateway=

    Where:ID is the number from Step 2 aboveStaticIP is the static IP address that you are setting

    SubnetMaskis the subnet mask for the IP addressDefaultGatewayis the default gateway

    4. At the command prompt, type:

    netsh interface ipv4 add dnsserver name=""

    address=index=1

    Microsoft 10/26/2013 10

  • 7/27/2019 PHP on IIS7 and Server Core.doc

    11/23

    IIS on Server Core

    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 canchange back to the DHCP address supplied by using the following command:

    netsh interface ipv4 set address name="" source=dhcp

    Where:ID is the number of the network adapter from Step 2 above

    To change the servers hostname:

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

    ipconfig command.

    2. At a command prompt, type:

    netdomrenamecomputer/NewName:

    3. Restart the computer.

    To activate the server

    At the command prompt, type:

    slmgr.vbsato=-

    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 typingthe following command at a command prompt of a computer that is runningWindows Vista or Windows Server 2008:

    cscript windows\system32\slmgr.vbs:-ato

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

    Microsoft 10/26/2013 11

  • 7/27/2019 PHP on IIS7 and Server Core.doc

    12/23

    IIS on Server Core

    Managing a Server Core installation

    The following procedures provide examples of common methods for managing aserver 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 forthe 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 followingcommand at a command prompt:cscript C:\Windows\System32\ Scregedit.wsf /ar 0

    This enables the Remote Desktop for Administration mode to acceptconnections.

    2. On another computer, click Start, click Run, type mstsc, and thenclick OK.

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

    4. Log on using an administrator account.

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

    6. When you have finished remotely managing the computer, typelogoffin 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 inWindows Server 2008. To do this, after step 1, type the following command atthe command prompt:

    Microsoft 10/26/2013 12

  • 7/27/2019 PHP on IIS7 and Server Core.doc

    13/23

    IIS on Server Core

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

    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 astandard Windows Server 2008 installation and the latest Terminal Servicesclient.

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

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

    2. Start MMC on the standard Windows Server 2008 computer, add theTS 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, andthen navigate to \\\c$\windows\system32\cmd.exe(where ServerName is the name of the server running a Server Coreinstallation).

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

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

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

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

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

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

    Note:The WinRMquickconfig setting enables a server running a Server Coreinstallation to accept Windows Remote Shell connections. This setting can

    Microsoft 10/26/2013 13

  • 7/27/2019 PHP on IIS7 and Server Core.doc

    14/23

    IIS on Server Core

    also be set in an unattended file.

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

    SummaryThe Server Core installation provides the following benefits:

    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 diskspace 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 ofWindows 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

    Microsoft 10/26/2013 14

  • 7/27/2019 PHP on IIS7 and Server Core.doc

    15/23

    IIS on Server Core

    installations. Because there is no support for managed code, the following IISfeatures are not available in Server Core installations:

    IIS-ASPNET

    IIS-NetFxExtensibility

    IIS-ManagementConsole

    IIS-ManagementService

    IIS-LegacySnapIn

    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 thefollowing.

    To install the Web Server role:

    1. For the default installation, type the following at a commandprompt 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 theirIIS 7.0 installation by adding additional IIS 7.0 Modules and features asneeded.

    For detailed IIS 7.0 module installation instructions and referenceinformation, 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 controlsand config file automation, IIS 7.0 is a powerful, adaptable Web server. IIS 7.0functionality will be enhanced as Microsoft works with Zend to improve PHPsupport on Windows.

    Microsoft 10/26/2013 15

    http://www.iis.net/articles/view.aspx/IIS7/Managing-IIS7/Configuring-the-IIS7-Runtime/Configuring-Modules/IIS7-Modules-Overview?Page=4http://www.iis.net/articles/view.aspx/IIS7/Managing-IIS7/Configuring-the-IIS7-Runtime/Configuring-Modules/IIS7-Modules-Overview?Page=4http://www.iis.net/articles/view.aspx/IIS7/Managing-IIS7/Configuring-the-IIS7-Runtime/Configuring-Modules/IIS7-Modules-Overview?Page=4http://www.iis.net/articles/view.aspx/IIS7/Managing-IIS7/Configuring-the-IIS7-Runtime/Configuring-Modules/IIS7-Modules-Overview?Page=4
  • 7/27/2019 PHP on IIS7 and Server Core.doc

    16/23

    IIS on Server Core

    Microsoft 10/26/2013 16

  • 7/27/2019 PHP on IIS7 and Server Core.doc

    17/23

    IIS on Server Core

    Managing IIS 7.0 on Server Core Installations

    There 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 fromthe 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 Coreinstallation.

    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.0

    Installing Fast-CGI Support

    FastCGI is a language-independent, scalable, open extension to CGI that provideshigh performance. The FastCGI extension is installable onto Server Core andenables application frameworks such as PHP to achieve improved performance andstability on IIS. Installing FastCGI when hosting PHP applications is very stronglyrecommended. In this example we will install FastCGI support to prepare the serverto host our PHP application.

    To install FastCGI and Static Content Web Server support, type the following textinto 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-

    Microsoft 10/26/2013 17

    http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspxhttp://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspxhttp://www.microsoft.com/technet/scriptcenter/scripts/msh/default.mspx?mfr=truehttp://www.microsoft.com/technet/scriptcenter/scripts/msh/default.mspx?mfr=truehttp://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspxhttp://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspxhttp://www.microsoft.com/technet/scriptcenter/scripts/msh/default.mspx?mfr=truehttp://www.microsoft.com/technet/scriptcenter/scripts/msh/default.mspx?mfr=true
  • 7/27/2019 PHP on IIS7 and Server Core.doc

    18/23

    IIS on Server Core

    RequestFiltering;IIS-HttpCompressionStatic;IIS-

    WebServerManagementTools;WAS-WindowsActivationService;WAS-

    ProcessModel

    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.execan be found at %WinDir%\System32\InetSrv directory.

    2. Depending on the PHP installation location, paths to executables on the harddisk may require updates. All AppCmd example commands above assumethat 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',scriptProc

    essor='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 zipextension.

    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 ServerCore 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 previouslyinto

    %SystemDrive%\PHP

    Microsoft 10/26/2013 18

  • 7/27/2019 PHP on IIS7 and Server Core.doc

    19/23

    IIS on Server Core

    6. Execute the following command:

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

    %\PHP\PHP.INI

    Testing the PHP Configuration

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

    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 10/26/2013 19

  • 7/27/2019 PHP on IIS7 and Server Core.doc

    20/23

    IIS on Server Core

    Figure 1 PHP Configuration data

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

    Microsoft 10/26/2013 20

  • 7/27/2019 PHP on IIS7 and Server Core.doc

    21/23

    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-basedimage 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 anonline gallery or set of galleries. Qdig supports image captions and display of EXIFimage 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 10/26/2013 21

  • 7/27/2019 PHP on IIS7 and Server Core.doc

    22/23

    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 thisdirectory

    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 10/26/2013 22

  • 7/27/2019 PHP on IIS7 and Server Core.doc

    23/23

    IIS on Server Core

    Conclusion

    The 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 applicationsand provides modern management within an enterprise-level server system. ServerCores simplicity, small footprint, and focused capabilities make an ideal foundationfor the IIS 7.0 Web server. IIS 7.0 makes Web sites and applications more secure byautomatically isolating them, providing sandboxed configurations and uniqueprocess identity. IIS 7.0 also lowers costs by providing a scalable shared hostingarchitecture capable of hosting thousands of Web sites on a single server withoutsacrificing isolation or reliability.

    These features provide the IT community with a secure, reliable Web server toolsetthat integrates into the corporate enterprise environment.