install.windows.iis.html
来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 435 行 · 第 1/2 页
HTML
435 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Microsoft IIS / PWS</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="install.windows.activescript.html">ActiveScript</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.iis" class="sect1"> <h2 class="title">Microsoft IIS / PWS</h2> <p class="para"> This section contains notes and hints specific to IIS (Microsoft Internet Information Server). </p> <div class="warning"><b class="warning">Warning</b><p class="para">A server deployed in CGI mode is opento several possible vulnerabilities. Please read our<a href="security.cgi-bin.html" class="link">CGI security section</a> to learn how todefend yourself from such attacks.</p></div> <div id="install.windows.iis.general" class="sect2"> <h3 class="title">General considerations for all installations of PHP with IIS or PWS</h3> <p class="para"> <ul class="itemizedlist"> <li class="listitem"> <span class="simpara"> First, read the <a href="install.windows.manual.html" class="link">Manual Installation Instructions</a>. Do not skip this step as it provides crucial information for installing PHP on Windows. </span> </li> <li class="listitem"> <span class="simpara"> CGI users must set the <a href="ini.core.html#ini.cgi.force-redirect" class="link"> cgi.force_redirect</a> PHP directive to <i>0</i> inside <var class="filename">php.ini</var>. Read the <a href="faq.installation.html#faq.installation.forceredirect" class="link">faq on cgi.force_redirect</a> for important details. Also, CGI users may want to set the <a href="ini.core.html#ini.cgi.redirect-status-env" class="link"> cgi.redirect_status_env</a> directive. When using directives, be sure these directives aren't commented out inside <var class="filename">php.ini</var>. </span> </li> <li class="listitem"> <span class="simpara"> The PHP 4 CGI is named <var class="filename">php.exe</var> while in PHP 5 it's <var class="filename">php-cgi.exe</var>. In PHP 5, <var class="filename">php.exe</var> is the CLI, and not the CGI. </span> </li> <li class="listitem"> <span class="simpara"> Modify the Windows <i>PATH</i> environment variable to include the PHP directory. This way the PHP DLL files and PHP executables can all remain in the PHP directory without cluttering up the Windows system directory. For more details, see the FAQ on <a href="faq.installation.html#faq.installation.addtopath" class="link">Setting the PATH</a>. </span> </li> <li class="listitem"> <span class="simpara"> The IIS user (usually IUSR_MACHINENAME) needs permission to read various files and directories, such as <var class="filename">php.ini</var>, docroot, and the session tmp directory. </span> </li> <li class="listitem"> <span class="simpara"> Be sure the <a href="ini.core.html#ini.extension-dir" class="link">extension_dir</a> and <a href="ini.core.html#ini.doc-root" class="link">doc_root</a> PHP directives are appropriately set in <var class="filename">php.ini</var>. These directives depend on the system that PHP is being installed on. In PHP 4, the extension_dir is <var class="filename">extensions</var> while with PHP 5 it's <var class="filename">ext</var>. So, an example PHP 5 extensions_dir value is <var class="filename">"c:\php\ext"</var> and an example IIS doc_root value is <var class="filename">"c:\Inetpub\wwwroot"</var>. </span> </li> <li class="listitem"> <span class="simpara"> PHP extension DLL files, such as <var class="filename">php_mysql.dll</var> and <var class="filename">php_curl.dll</var>, are found in the zip package of the PHP download (not the PHP installer). In PHP 5, many extensions are part of PECL and can be downloaded in the "Collection of PECL modules" package. Files such as <var class="filename">php_zip.dll</var> and <var class="filename">php_ssh2.dll</var>. <a href="http://www.php.net/downloads.php" class="link external">» Download PHP files here</a>. </span> </li> <li class="listitem"> <span class="simpara"> When defining the executable, the 'check that file exists' box may also be checked. For a small performance penalty, the IIS (or PWS) will check that the script file exists and sort out authentication before firing up PHP. This means that the web server will provide sensible 404 style error messages instead of CGI errors complaining that PHP did not output any data. </span> </li> <li class="listitem"> <span class="simpara"> The PHP executable is distributed as a 32bit application. If you are running a 64bit version of Windows you will either need to rebuild the binary yourself, or make sure IIS is configured to also run 32bit extensions. You can usually turn this on by using the IIS Administration script as follows: Cscript.exe adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1 </span> </li> </ul> </p> </div> <div id="install.windows.iis.iis4" class="sect2"> <h3 class="title">Windows NT/200x/XP and IIS 4 or newer</h3> <p class="simpara"> 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'. </p> <p class="para"> If you want to use the CGI binary, do the following: <ul class="itemizedlist"> <li class="listitem"> <span class="simpara"> Under 'Home Directory', 'Virtual Directory', or 'Directory', do the following: </span> </li> <li class="listitem"> <span class="simpara"> Change the Execute Permissions to 'Scripts only' </span> </li> <li class="listitem"> <span class="simpara"> 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: <var class="filename">C:\php\php-cgi.exe</var> Supply <i>.php</i> as the extension. Leave 'Method exclusions' blank, and check the 'Script engine' checkbox. Now, click OK a few times. </span> </li> <li class="listitem"> <span class="simpara"> 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 <var class="filename">php.exe</var> / <var class="filename">php-cgi.exe</var>. </span> </li> </ul> </p> <p class="para"> To use the ISAPI module, do the following: <ul class="itemizedlist"> <li class="listitem"> <span class="simpara"> 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 <var class="filename">php4isapi.dll</var> / <var class="filename">php5isapi.dll</var>. </span> </li> <li class="listitem"> <span class="simpara"> Under 'Home Directory', 'Virtual Directory', or 'Directory', do the following: </span> </li> <li class="listitem"> <span class="simpara"> Change the Execute Permissions to 'Scripts only' </span> </li> <li class="listitem"> <span class="simpara"> 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: <var class="filename">C:\php\php5isapi.dll</var> Supply <i>.php</i> as the extension. Leave 'Method exclusions' blank, and check the 'Script engine' checkbox. Now, click OK a few times. </span> </li> <li class="listitem"> <span class="simpara"> Stop IIS completely (NET STOP iisadmin) </span> </li> <li class="listitem"> <span class="simpara"> Start IIS again (NET START w3svc) </span> </li> </ul> </p> <p class="para"> 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 (<var class="filename">php4isapi.dll</var> or <var class="filename">php5isapi.dll</var>) or CGI (<var class="filename">php.exe</var> or <var class="filename">php-cgi.exe</var>) then check "Set extension status to Allowed" and click OK. </p> <p class="para"> In order to use <var class="filename">index.php</var> as a default content page,
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?