Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 8237

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Microsoft IIS 7.0 and later</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="install.windows.iis6.html">Microsoft IIS 5.1 and IIS 6.0</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="install.windows.apache1.html">Apache 1.3.x on Microsoft Windows</a></div>
 <div class="up"><a href="install.windows.html">Installation on Windows systems</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="install.windows.iis7" class="sect1">
 <h2 class="title">Microsoft IIS 7.0 and later</h2>
 <p class="para">
  This section contains instructions for manually setting up Internet Information 
  Services (IIS) 7.0 and later to work with PHP on Microsoft Windows Vista SP1, 
  Windows 7, Windows Server 2008 and Windows Server 2008 R2. For instructions 
  on setting up IIS 5.1 and IIS 6.0 on Windows XP and Windows Server 2003 refer to 
  <a href="install.windows.iis6.html" class="link">Microsoft IIS 5.1 and IIS 6.0</a>.
 </p>
 <div class="sect2" id="install.windows.iis7.fastcgi.enable">
  <h3 class="title">Enabling FastCGI support in IIS</h3>
  <p class="para">
   FastCGI module is disabled in default installation of IIS. The steps to enable it differ 
   based on the version of Windows being used.
  </p>
  <p class="para">
   To enable FastCGI support on Windows Vista SP1 and Windows 7:
   <div class="procedure">
    <ol type="1"><li>
     <p class="simpara">
      In the Windows Start Menu choose &quot;Run:&quot;, type &quot;optionalfeatures.exe&quot; 
      and click &quot;Ok&quot;;
     </p>
    </li>
    <li>
     <p class="simpara">
      In the &quot;Windows Features&quot; dialog expand &quot;Internet Information 
      Services&quot;, &quot;World Wide Web Services&quot;, &quot;Application Development 
      Features&quot; and then enable the &quot;CGI&quot; checkbox;
     </p>
    </li>
    <li>
     <p class="simpara">
      Click OK and wait until the installation is complete.
     </p>
    </li>
   </ol></div>
   <div class="mediaobject">
    
    <div class="imageobject">
     <img src="images/b4cf2bb34e3c20eebcf8f9e8e7949efd-iis7vistacgi.png" alt="Enabling FastCGI support for IIS7 on Windows Vista SP1 and Windows 7" width="429" height="375" />
    </div>
   </div>
  </p>
  <p class="para">
   To enable FastCGI support on Windows Server 2008 and Windows Server 2008 R2:
   <div class="procedure">
    <ol type="1"><li>
     <p class="simpara">
      In the Windows Start Menu choose &quot;Run:&quot;, type &quot;CompMgmtLauncher&quot; 
      and click &quot;Ok&quot;;
     </p>
    </li>
    <li>
     <p class="simpara">
      If the &quot;Web Server (IIS)&quot; role is not present under the &quot;Roles&quot; 
      node, then add it by clicking &quot;Add Roles&quot;;
     </p>
    </li>
    <li>
     <p class="simpara">
      If the &quot;Web Server (IIS)&quot; role is present, then click &quot;Add Role Services&quot; 
      and then enable the &quot;CGI&quot; checkbox under &quot;Application Development&quot; group;
     </p>
    </li>
    <li>
     <p class="simpara">
      Click &quot;Next&quot; and then &quot;Install&quot; and wait for the installation to complete.
     </p>
    </li>
   </ol></div>
   <div class="mediaobject">
    
    <div class="imageobject">
     <img src="images/b4cf2bb34e3c20eebcf8f9e8e7949efd-iis7w2k8cgi.png" alt="Enabling FastCGI support on Windows Server 2008 and Windows Server 2008 R2" width="546" height="411" />
    </div>
   </div>
  </p>
 </div>
 <div class="sect2" id="install.windows.iis7.fastcgi.conf">
  <h3 class="title">Configuring IIS to process PHP requests</h3>
  <p class="para">
   Download and install PHP in accordance to the instructions described in 
    <a href="install.windows.manual.html" class="link">manual installation steps</a>
    <blockquote class="note"><p><strong class="note">Note</strong>: 
     <p class="para">
      Non-thread-safe build of PHP is recommended when using IIS. The non-thread-safe 
      builds are available at <a href="http://windows.php.net/download/" class="link external">&raquo;&nbsp;PHP for Windows: 
      Binaries and Sources Releases.</a>
     </p>
    </p></blockquote>
  </p>
  <p class="para">
   Configure the CGI- and FastCGI-specific settings in <var class="filename">php.ini</var> file as shown below:
   <div class="example" id="example-42">
    <p><strong>Example #1 CGI and FastCGI settings in <var class="filename">php.ini</var></strong></p>
    <div class="example-contents">
<div class="inicode"><pre class="inicode">fastcgi.impersonate = 1
fastcgi.logging = 0
cgi.fix_pathinfo=1
cgi.force_redirect = 0</pre>
</div>
    </div>

   </div>
  </p>
  <p class="para">
   Configure IIS handler mapping for PHP by using either IIS Manager user interface or a command line tool.
  </p>
  <div class="sect3" id="install.windows.iis7.fastcgi.conf.ui">
   <h4 class="title">Using IIS Manager user interface to create a handler mapping for PHP</h4>
    <p class="para">
     Follow these steps to create an IIS handler mapping for PHP in IIS Manager user interface:
     <div class="procedure">
      <ol type="1"><li>
       <p class="simpara">In the Windows Start Menu choose &quot;Run:&quot;, type &quot;inetmgr&quot; and click &quot;Ok&quot;;</p>
      </li>
      <li>
       <p class="simpara">In the IIS Manager user interface select the server node in the &quot;Connections&quot; tree view;</p>
      </li>
      <li>
       <p class="para">
        In the &quot;Features View&quot; page open the &quot;Handler Mappings&quot; feature;
        <div class="mediaobject">
         
         <div class="imageobject">
          <img src="images/b4cf2bb34e3c20eebcf8f9e8e7949efd-iis7handlericon.png" alt="Create IIS handler mapping for PHP : Locate Handler Mappings" width="708" height="515" />
         </div>
        </div>
       </p>
      </li>
      <li>
       <p class="simpara">In the &quot;Actions&quot; pane click &quot;Add Module Mapping...&quot;;</p>
      </li>
      <li>
       <p class="para">
        In the &quot;Add Module Mapping&quot; dialog enter the following:
        <ul class="itemizedlist">
         <li class="listitem">
          <span class="simpara">Request path: *.php</span>
         </li>
         <li class="listitem">
          <span class="simpara">Module: FastCgiModule</span>
         </li>
         <li class="listitem">
          <span class="simpara">Executable: C:\[Path to PHP installation]\php-cgi.exe</span>
         </li>
         <li class="listitem">
          <span class="simpara">Name: PHP_via_FastCGI</span>
         </li>
        </ul>
       </p>
      </li>
      <li>
       <p class="simpara">
        Click &quot;Request Restrictions&quot; button and then configure the mapping to invoke handler 
        only if request is mapped to a file or a folder;
        </p>
      </li>
      <li>
       <p class="simpara">Click OK on all the dialogs to save the configuration.</p>
      </li>
     </ol></div>
     <div class="mediaobject">
      
      <div class="imageobject">
       <img src="images/b4cf2bb34e3c20eebcf8f9e8e7949efd-iis7handlermap.png" alt="Create IIS handler mapping for PHP : Add Handler Mapping" width="705" height="512" />
      </div>
     </div>
    </p>
  </div>
  <div class="sect3" id="install.windows.iis7.fastcgi.conf.cmd">
   <h4 class="title">Using command line tool to create a handler mapping for PHP</h4>
   <p class="para">
    Use the command shown below to create an IIS FastCGI process pool which will use <var class="filename">php-cgi.exe</var> 
    executable for processing PHP requests. Replace the value of the <var class="varname"><var class="varname">fullPath</var></var> parameter with the 
    absolute file path to the <var class="filename">php-cgi.exe</var> file.
    <div class="example" id="example-43">
     <p><strong>Example #2 Creating IIS FastCGI process pool</strong></p>
     <div class="example-contents">
<div class="cdata"><pre>
%windir%\system32\inetsrv\appcmd set config /section:system.webServer/fastCGI ^
/+[fullPath=&#039;c:\PHP\php-cgi.exe&#039;]
</pre></div>
     </div>

    </div>
   </p>
   <p class="para">
    Configure IIS to handle PHP specific requests by running the command shown below. Replace the value of the 
    <var class="varname"><var class="varname">scriptProcessor</var></var> parameter with the absolute file path to the <var class="filename">php-cgi.exe</var> file.
    <div class="example" id="example-44">
     <p><strong>Example #3 Creating handler mapping for PHP requests</strong></p>
     <div class="example-contents">
<div class="cdata"><pre>
%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;c:\PHP\php-cgi.exe&#039;,resourceType=&#039;Either&#039;]
</pre></div>
     </div>

    </div>
   </p>
   <p class="para">
    This command creates an IIS handler mapping for *.php file extension, which will result in all URLs that 
    end with .php being handled by FastCGI module.
    <blockquote class="note"><p><strong class="note">Note</strong>: 
     <p class="para">
      At this point the required installation and configuration steps are completed. The remaining 
      instructions below are optional but highly recommended for achieving optimal functionality 
      and performance of PHP on IIS.
     </p>
    </p></blockquote>
   </p>
  </div>
 </div>
 <div class="sect2" id="install.windows.iis7.impersonation">
  <h3 class="title">Impersonation and file system access</h3>
  <p class="para">
   It is recommended to enable FastCGI impersonation in PHP when using IIS. This 
   is controlled by the <var class="varname"><var class="varname">fastcgi.impersonate</var></var> directive in <var class="filename">php.ini</var> 
   file. When impersonation is enabled, PHP will perform all the file system operations on behalf of 
   the user account that has been determined by IIS authentication. This ensures that even if the 
   same PHP process is shared across different IIS web sites, the PHP scripts in those web sites 
   will not be able to access each other&#039;s files as long as different user accounts are used 
   for IIS authentication on each web site.
  </p>
  <p class="para">
   For example IIS 7, in its default configuration, has anonymous authentication enabled with 
   built-in user account IUSR used as a default identity. This means that in order for IIS to 
   execute PHP scripts, it is necessary to grant IUSR account read permission on those scripts. 
   If PHP applications need to perform write operations on certain files or write files into some 
   folders then IUSR account should have write permission to those.
  </p>
  <p class="para">
   To determine what user account is used as an anonymous identity in IIS 7 use the following command. 
   Replace the &quot;Default Web Site&quot; with the name of IIS web site that you use. In the output 
   XML configuration element look for the <var class="varname"><var class="varname">userName</var></var> attribute.
   <div class="example" id="example-45">
    <p><strong>Example #4 Determining the account used as IIS anonymous identity</strong></p>
    <div class="example-contents">
<div class="cdata"><pre>
%windir%\system32\inetsrv\appcmd.exe list config &quot;Default Web Site&quot; ^
/section:anonymousAuthentication

&lt;system.webServer&gt;
  &lt;security&gt;
    &lt;authentication&gt;
      &lt;anonymousAuthentication enabled=&quot;true&quot; userName=&quot;IUSR&quot; /&gt;
    &lt;/authentication&gt;
   &lt;/security&gt;
&lt;/system.webServer&gt;
</pre></div>
    </div>

   </div>
   <blockquote class="note"><p><strong class="note">Note</strong>: 
    <p class="para">
     If <var class="varname"><var class="varname">userName</var></var> attribute is not present in the <var class="varname"><var class="varname">anonymousAuthentication</var></var> element, 
     or is set to an empty string, then it means that the application pool identity is used as an 
     anonymous identity for that web site.
    </p>
   </p></blockquote>
  </p>
  <p class="para">
   To modify the permissions settings on files and folders, use the Windows Explorer 
   user interface or <var class="varname"><var class="varname">icacls</var></var> command.
   <div class="example" id="example-46">
    <p><strong>Example #5 Configuring file access permissions</strong></p>
    <div class="example-contents">
<div class="cdata"><pre>
icacls C:\inetpub\wwwroot\upload /grant IUSR:(OI)(CI)(M)
</pre></div>
    </div>

   </div>
  </p>
 </div>
 <div class="sect2" id="install.windows.iis7.defaultdoc">
  <h3 class="title">Set <var class="filename">index.php</var> as a default document in IIS</h3>
  <p class="para">
   The IIS default documents are used for HTTP requests that do not specify a 
   document name. With PHP applications, <var class="filename">index.php</var> usually 
   acts as a default document. To add <var class="filename">index.php</var> to the list 
   of IIS default documents, use this command:
   <div class="example" id="example-47">
    <p><strong>Example #6 Set <var class="filename">index.php</var> as a default document in IIS</strong></p>
    <div class="example-contents">
<div class="cdata"><pre>
%windir%\system32\inetsrv\appcmd.exe set config ^
-section:system.webServer/defaultDocument /+&quot;files.[value=&#039;index.php&#039;]&quot; ^
/commit:apphost
</pre></div>
    </div>

   </div>   
  </p>
 </div>
 <div class="sect2" id="install.windows.iis7.recycling">
  <h3 class="title">FastCGI and PHP Recycling configuration</h3>
  <p class="para">
   Configure IIS FastCGI settings for recycling of PHP processes by using the commands shown below. 
   The FastCGI setting <var class="varname"><var class="varname">instanceMaxRequests</var></var> controls how many requests will be 
   processed by a single <var class="filename">php-cgi.exe</var> process before IIS shuts it down. 
   The PHP environment variable <var class="varname"><var class="varname">PHP_FCGI_MAX_REQUESTS</var></var> controls how many 
   requests a single <var class="filename">php-cgi.exe</var> process will handle before it recycles 
   itself. Make sure that the value specified for FastCGI <var class="varname"><var class="varname">InstanceMaxRequests</var></var> 
   setting is less than or equal to the value specified for <var class="varname"><var class="varname">PHP_FCGI_MAX_REQUESTS</var></var>.
   <div class="example" id="example-48">
    <p><strong>Example #7 Configuring FastCGI and PHP recycling</strong></p>
    <div class="example-contents">
<div class="cdata"><pre>
%windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi ^
/[fullPath=&#039;c:\php\php-cgi.exe&#039;].instanceMaxRequests:10000

%windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi ^
/+&quot;[fullPath=&#039;C:\{php_folder}\php-cgi.exe&#039;].environmentVariables.^
[name=&#039;PHP_FCGI_MAX_REQUESTS&#039;,value=&#039;10000&#039;]&quot;
</pre></div>
    </div>

   </div>
  </p>
 </div>
 <div class="sect2" id="install.windows.iis7.timeouts">
  <h3 class="title">FastCGI timeout settings</h3>
  <p class="para">
   Increase the timeout settings for FastCGI if it is expected to have long running PHP scripts.
   The two settings that control timeouts are <var class="varname"><var class="varname">activityTimeout</var></var> and 
   <var class="varname"><var class="varname">requestTimeout</var></var>. Use the commands below to change the timeout settings. 
   Make sure to replace the value in the <var class="varname"><var class="varname">fullPath</var></var> parameter to 
   contain the absolute path to the <var class="filename">php-cgi.exe</var> file.
   <div class="example" id="example-49">
    <p><strong>Example #8 Configuring FastCGI timeout settings</strong></p>
    <div class="example-contents">
<div class="cdata"><pre>
%windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi ^
/[fullPath=&#039;C:\php\php-cgi.exe&#039;,arguments=&#039;&#039;].activityTimeout:&quot;90&quot;  /commit:apphost

%windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi ^
/[fullPath=&#039;C:\php\php-cgi.exe&#039;,arguments=&#039;&#039;].requestTimeout:&quot;90&quot;  /commit:apphost
</pre></div>
    </div>

   </div>   
  </p>
 </div>
 <div class="sect2" id="install.windows.iis7.phpinilocation">
  <h3 class="title">Changing the Location of <var class="filename">php.ini</var> file</h3>
  <p class="para">
   PHP searches for <var class="filename">php.ini</var> file in 
   <a href="configuration.file.html" class="link">several locations</a> and it is 
   possible to change the default locations of <var class="filename">php.ini</var> 
   file by using <var class="varname"><var class="varname">PHPRC</var></var> environment variable. To instruct PHP 
   to load the configuration file from a custom location run the command shown below. 
   The absolute path to the directory with <var class="filename">php.ini</var> file should be 
   specified as a value of <var class="varname"><var class="varname">PHPRC</var></var> environment variable.
   <div class="example" id="example-50">
    <p><strong>Example #9 Changing the location of <var class="filename">php.ini</var> file</strong></p>
    <div class="example-contents">
<div class="cdata"><pre>
appcmd.exe set config  -section:system.webServer/fastCgi ^
/+&quot;[fullPath=&#039;C:\php\php.exe&#039;,arguments=&#039;&#039;].environmentVariables.^
[name=&#039;PHPRC&#039;,value=&#039;C:\Some\Directory\&#039;]&quot; /commit:apphost
</pre></div>         
    </div>

   </div>   
  </p>
 </div>
</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="install.windows.iis6.html">Microsoft IIS 5.1 and IIS 6.0</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="install.windows.apache1.html">Apache 1.3.x on Microsoft Windows</a></div>
 <div class="up"><a href="install.windows.html">Installation on Windows systems</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>