<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/install.windows.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ru',
  ),
  'this' => 
  array (
    0 => 'install.windows.iis.php',
    1 => 'Установка PHP с веб-сервером IIS для ОС Windows',
    2 => 'Установка PHP с веб-сервером IIS для ОС Windows',
  ),
  'up' => 
  array (
    0 => 'install.windows.php',
    1 => 'Установка в системы с ОС Windows',
  ),
  'prev' => 
  array (
    0 => 'install.windows.apache2.php',
    1 => 'Установка для веб-сервера Apache 2.x в системах Windows',
  ),
  'next' => 
  array (
    0 => 'install.windows.tools.php',
    1 => 'Сторонние инструменты для установки PHP',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ru',
    'path' => 'install/windows/iis.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="install.windows.iis" class="sect1">
 <h2 class="title">Установка PHP с веб-сервером IIS для ОС Windows</h2>

 <div class="simplesect">
  <h3 class="title">Установка веб-сервера ISS</h3>
  <p class="simpara">
   Веб-сервер Internet Information Services (IIS) встроили в операционную систему Windows.
   На ОС Windows Server роль IIS добавляют через диспетчер серверов Server Manager.
   Функцию роли CGI-интерфейса требуется включить.
   На настольных системах Windows Desktop роль IIS добавляется через пункт Панели управления «Установка и удаление программ».
   Документация Microsoft содержит
   <a href="https://docs.microsoft.com/en-us/previous-versions/ms181052(v=vs.80)" class="link external">&raquo;&nbsp;подробные инструкции о включении IIS</a>.
   Для разработки также устанавливают версию веб-сервера
   <a href="https://www.microsoft.com/en-us/download/details.aspx?id=48264" class="link external">&raquo;&nbsp;IIS Express</a>.
  </p>
  <blockquote class="note"><p><strong class="note">Замечание</strong>: 
   <span class="simpara">
    При запуске веб-сервера IIS с обработчиком FastCGI
    устанавливают непотокобезопасную версию PHP (англ. Non-Thread Safe, NTS).
   </span>
  </p></blockquote>
 </div>
 <div class="simplesect">
  <h3 class="title">Настройка PHP с IIS</h3>

  <p class="simpara">
   В диспетчере IIS устанавливают модуль FastCGI и сопоставляют обработку
   файлов с расширением <code class="literal">.php</code> с обработчиком скриптов по пути <var class="filename">php-cgi.exe</var>,
   но не <var class="filename">php.exe</var>.
  </p>

  <p class="simpara">
   Скрипт конфигурации веб-сервера IIS создают инструментом командной строки <strong class="command">APPCMD</strong>.
  </p>
 </div>
 <div class="simplesect">
  <h3 class="title">Пример пакетного скрипта</h3>
  <div class="example" id="example-1">
   <p><strong>Пример #1 Скрипт командной строки для настройки IIS и PHP</strong></p>
   <div class="example-contents">
<div class="cdata"><pre>

@echo off

REM download .ZIP file of PHP build from http://windows.php.net/downloads/

REM path to directory into which PHP .ZIP file was decompressed (no trailing \)
set phppath=c:\php


REM Clear current PHP handlers
%windir%\system32\inetsrv\appcmd clear config /section:system.webServer/fastCGI
REM The following command will generate an error message if PHP is not installed. This can be ignored.
%windir%\system32\inetsrv\appcmd set config /section:system.webServer/handlers /-[name=&#039;PHP_via_FastCGI&#039;]

REM Set up the PHP handler
%windir%\system32\inetsrv\appcmd set config /section:system.webServer/fastCGI /+[fullPath=&#039;%phppath%\php-cgi.exe&#039;]
%windir%\system32\inetsrv\appcmd set config /section:system.webServer/handlers /+[name=&#039;PHP_via_FastCGI&#039;,path=&#039;*.php&#039;,verb=&#039;*&#039;,modules=&#039;FastCgiModule&#039;,scriptProcessor=&#039;%phppath%\php-cgi.exe&#039;,resourceType=&#039;Unspecified&#039;]
%windir%\system32\inetsrv\appcmd set config /section:system.webServer/handlers /accessPolicy:Read,Script

REM Configure FastCGI Variables
%windir%\system32\inetsrv\appcmd set config -section:system.webServer/fastCgi /[fullPath=&#039;%phppath%\php-cgi.exe&#039;].instanceMaxRequests:10000
%windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi /+&quot;[fullPath=&#039;%phppath%\php-cgi.exe&#039;].environmentVariables.[name=&#039;PHP_FCGI_MAX_REQUESTS&#039;,value=&#039;10000&#039;]&quot;
%windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi /+&quot;[fullPath=&#039;%phppath%\php-cgi.exe&#039;].environmentVariables.[name=&#039;PHPRC&#039;,value=&#039;%phppath%\php.ini&#039;]&quot;
</pre></div>
   </div>

  </div>
 </div>
</div><?php manual_footer($setup); ?>