This section contains notes and hints specific to IIS (Microsoft
  Internet Information Server).
 
 
  Windows NT/200x/XP and IIS 4 or newer
  
   PHP may be installed as a CGI binary, or with the ISAPI module.
   In either case, you need to start the Microsoft Management
   Console (may appear as 'Internet Services Manager', either
   in your Windows NT 4.0 Option Pack branch or the Control
   Panel=>Administrative Tools under Windows 2000/XP). Then
   right click on your Web server node (this will most probably
   appear as 'Default Web Server'), and select 'Properties'.
  
  
   If you want to use the CGI binary, do the following:
   
    - 
     
      Under 'Home Directory', 'Virtual Directory', or 'Directory', do the 
      following:
     
    
 
    - 
     
      Change the Execute Permissions to 'Scripts only'
     
    
 
    - 
     
      Click on the 'Configuration' button, and choose the Application Mappings 
      tab. Click Add and set the Executable path to the appropriate CGI file.
      An example PHP 5 value is: C:\php\php-cgi.exe
      Supply .php as the extension. Leave 'Method 
      exclusions' blank, and check the 'Script engine' checkbox. Now, click 
      OK a few times.
     
    
 
    - 
     
      Set up the appropriate security. (This is done in Internet
      Service Manager), and if your NT Server uses NTFS file system,
      add execute rights for I_USR_ to the directory that contains
      php.exe / php-cgi.exe.
     
    
 
   
  
  
   To use the ISAPI module, do the following:
   
    - 
     
      If you don't want to perform HTTP Authentication using PHP,
      you can (and should) skip this step. Under ISAPI Filters,
      add a new ISAPI filter. Use PHP as the filter name, and
      supply a path to the php4isapi.dll /
      php5isapi.dll.
     
    
 
    - 
     
      Under 'Home Directory', 'Virtual Directory', or 'Directory', do the 
      following:
     
    
 
    - 
     
      Change the Execute Permissions to 'Scripts only'
     
    
 
    - 
     
      Click on the 'Configuration' button, and choose the Application Mappings 
      tab. Click Add and set the Executable path to the appropriate ISAPI DLL.
      An example PHP 5 value is: C:\php\php5isapi.dll
      Supply .php as the extension. Leave 'Method 
      exclusions' blank, and check the 'Script engine' checkbox. Now, click 
      OK a few times.
     
    
 
    - 
     
      Stop IIS completely (NET STOP iisadmin)
     
    
 
    - 
     
      Start IIS again (NET START w3svc)
     
    
 
   
  
  
   With IIS 6 (2003 Server), open up the IIS Manager, go to Web Service 
   Extensions, choose "Add a new Web service extension", enter in a name such 
   as PHP, choose the Add button and for the value browse to either the ISAPI 
   file (php4isapi.dll or 
   php5isapi.dll) or CGI (php.exe or 
   php-cgi.exe) then check "Set extension status to 
   Allowed" and click OK.
  
  
   In order to use index.php as a default content page, 
   do the following: From within the Documents tab, choose Add. Type in
   index.php and click OK. Adjust the order by choosing
   Move Up or Move Down. This is similar to setting DirectoryIndex with
   Apache.
  
  
   The steps above must be repeated for each extension that is to be 
   associated with PHP scripts. .php is the most common 
   although .php3 may be required for legacy applications.
  
  
   If you experience 100% CPU usage after some time, turn off the IIS
   setting Cache ISAPI Application.
  
  
 
  Windows and PWS/IIS 3
  
   The recommended method for configuring these servers is to use
   the REG file included with the distribution
   (pws-php4cgi.reg in the SAPI folder for PHP 4, or
   pws-php5cgi.reg in the main folder for PHP 5).
   You may want to edit this file and make sure
   the extensions and PHP install directories match your
   configuration. Or you can follow the steps below to do it
   manually.
  
  Warning
   
    These steps involve working directly with the Windows
    registry. One error here can leave your system in an unstable
    state. We highly recommend that you back up your registry
    first. The PHP Development team will not be held responsible if
    you damage your registry.
   
   
  
   
    - 
     
      Run Regedit.
     
    
 
    - 
     
      Navigate to: HKEY_LOCAL_MACHINE /System
       /CurrentControlSet /Services /W3Svc /Parameters
       /ScriptMap.
     
    
 
    - 
     
      On the edit menu select: New->String Value.
     
    
 
    - 
     
      Type in the extension you wish to use for your php
      scripts. For example .php
     
    
 
    - 
     
      Double click on the new string value and enter the path to
      php.exe in the value data field. ex:
      C:\php\php.exe "%s" %s for PHP 4, or
      C:\php\php-cgi.exe "%s" %s for PHP 5.
     
    
 
    - 
     
      Repeat these steps for each extension you wish to associate
      with PHP scripts.
     
    
 
   
  
  
   The following steps do not affect the web server installation
   and only apply if you want your PHP scripts to be executed when
   they are run from the command line (ex. run
   C:\myscripts\test.php) or by double clicking
   on them in a directory viewer window. You may wish to skip these
   steps as you might prefer the PHP files to load into a text
   editor when you double click on them.
  
  
   
    - 
     
      Navigate to: HKEY_CLASSES_ROOT
     
    
 
    - 
     
      On the edit menu select: New->Key.
     
    
 
    - 
     
      Name the key to the extension you setup in the previous
      section. ex: .php
     
    
 
    - 
     
      Highlight the new key and in the right side pane, double click
      the "default value" and enter phpfile.
     
    
 
    - 
     
      Repeat the last step for each extension you set up in the
      previous section.
     
    
 
    - 
     
      Now create another New->Key under
      HKEY_CLASSES_ROOT and name it
      phpfile.
     
    
 
    - 
     
      Highlight the new key phpfile and in the
      right side pane, double click the "default value" and enter
      PHP Script.
     
    
 
    - 
     
      Right click on the phpfile key and select
      New->Key, name it Shell.
     
    
 
    - 
     
      Right click on the Shell key and select
      New->Key, name it open.
     
    
 
    - 
     
      Right click on the open key and select
      New->Key, name it
      command.
     
    
 
    - 
     
      Highlight the new key command and in the
      right side pane, double click the "default value" and enter
      the path to php.exe. ex:
      c:\php\php.exe -q %1. (don't forget the
      %1).
     
    
 
    - 
     
      Exit Regedit.
     
    
 
    - 
     
      If using PWS on Windows, reboot to reload the registry.
     
    
 
   
  
  
   PWS and IIS 3 users now have a fully operational system. IIS 3
   users can use a nifty » tool
   from Steven Genusa to configure their script maps.