|
| 1 | +<?xml version="1.0" encoding="utf-8"?> |
| 2 | +<!-- $Revision$ --> |
| 3 | +<!-- EN-Revision: 2dbf3d9064d4cb07f0a2f7d06641c877a2e5ed24 Maintainer: mowangjuanzi Status: ready --> |
| 4 | +<sect1 xml:id="install.windows.iis" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> |
| 5 | + <title>Windows 上与 IIS 安装</title> |
| 6 | + |
| 7 | + <simplesect> |
| 8 | + <title>安装 IIS</title> |
| 9 | + <simpara> |
| 10 | + Internet 信息服务 (IIS) 内置于 Windows 中。在 Windows Server 上,可以通过服务器管理器添加 IIS |
| 11 | + 角色。需要包含 CGI 角色功能。在 Windows 桌面上,必须通过控制面板的添加/删除程序添加 IIS。Microsoft 文档有<link |
| 12 | + xlink:href="https://docs.microsoft.com/en-us/previous-versions/ms181052(v=vs.80)">关于启用 IIS |
| 13 | + 的详细说明</link>。对于开发,也可以使用 <link xlink:href="https://www.microsoft.com/zh-cn/download/details.aspx?id=48264">IIS/Express</link>。 |
| 14 | + </simpara> |
| 15 | + <note> |
| 16 | + <simpara> |
| 17 | + 在 IIS 中使用 FastCGI 处理程序时,应安装 PHP 的非线程安全 (NTS) 版本。 |
| 18 | + </simpara> |
| 19 | + </note> |
| 20 | + </simplesect> |
| 21 | + <simplesect> |
| 22 | + <title>使用 IIS 配置 PHP-CGI</title> |
| 23 | + |
| 24 | + <simpara> |
| 25 | + 在 IIS 管理器中,安装 FastCGI 模块并将 <literal>.php</literal> 的处理程序映射到 |
| 26 | + <filename>php-cgi.exe</filename>(而不是 <filename>php.exe</filename>)的路径 |
| 27 | + </simpara> |
| 28 | + |
| 29 | + <simpara> |
| 30 | + <command>APPCMD</command> 命令行工具可用于编写 IIS 配置脚本。 |
| 31 | + </simpara> |
| 32 | + </simplesect> |
| 33 | + <simplesect> |
| 34 | + <title>批处理脚本示例</title> |
| 35 | + <example> |
| 36 | + <title>命令行配置 IIS 和 PHP</title> |
| 37 | + <programlisting> |
| 38 | +<![CDATA[ |
| 39 | +
|
| 40 | +@echo off |
| 41 | +
|
| 42 | +REM download .ZIP file of PHP build from http://windows.php.net/downloads/ |
| 43 | +
|
| 44 | +REM path to directory into which PHP .ZIP file was decompressed (no trailing \) |
| 45 | +set phppath=c:\php |
| 46 | +
|
| 47 | +
|
| 48 | +REM Clear current PHP handlers |
| 49 | +%windir%\system32\inetsrv\appcmd clear config /section:system.webServer/fastCGI |
| 50 | +REM The following command will generate an error message if PHP is not installed. This can be ignored. |
| 51 | +%windir%\system32\inetsrv\appcmd set config /section:system.webServer/handlers /-[name='PHP_via_FastCGI'] |
| 52 | +
|
| 53 | +REM Set up the PHP handler |
| 54 | +%windir%\system32\inetsrv\appcmd set config /section:system.webServer/fastCGI /+[fullPath='%phppath%\php-cgi.exe'] |
| 55 | +%windir%\system32\inetsrv\appcmd set config /section:system.webServer/handlers /+[name='PHP_via_FastCGI',path='*.php',verb='*',modules='FastCgiModule',scriptProcessor='%phppath%\php-cgi.exe',resourceType='Unspecified'] |
| 56 | +%windir%\system32\inetsrv\appcmd set config /section:system.webServer/handlers /accessPolicy:Read,Script |
| 57 | +
|
| 58 | +REM Configure FastCGI Variables |
| 59 | +%windir%\system32\inetsrv\appcmd set config -section:system.webServer/fastCgi /[fullPath='%phppath%\php-cgi.exe'].instanceMaxRequests:10000 |
| 60 | +%windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi /+"[fullPath='%phppath%\php-cgi.exe'].environmentVariables.[name='PHP_FCGI_MAX_REQUESTS',value='10000']" |
| 61 | +%windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi /+"[fullPath='%phppath%\php-cgi.exe'].environmentVariables.[name='PHPRC',value='%phppath%\php.ini']" |
| 62 | +]]> |
| 63 | + </programlisting> |
| 64 | + </example> |
| 65 | + </simplesect> |
| 66 | +</sect1> |
| 67 | +<!-- Keep this comment at the end of the file |
| 68 | +Local variables: |
| 69 | +mode: sgml |
| 70 | +sgml-omittag:t |
| 71 | +sgml-shorttag:t |
| 72 | +sgml-minimize-attributes:nil |
| 73 | +sgml-always-quote-attributes:t |
| 74 | +sgml-indent-step:1 |
| 75 | +sgml-indent-data:t |
| 76 | +indent-tabs-mode:nil |
| 77 | +sgml-parent-document:nil |
| 78 | +sgml-default-dtd-file:"~/.phpdoc/manual.ced" |
| 79 | +sgml-exposed-tags:nil |
| 80 | +sgml-local-catalogs:nil |
| 81 | +sgml-local-ecat-files:nil |
| 82 | +End: |
| 83 | +vim600: syn=xml fen fdm=syntax fdl=2 si |
| 84 | +vim: et tw=78 syn=sgml |
| 85 | +vi: ts=1 sw=1 |
| 86 | +--> |
0 commit comments