📄 install.windows.apache1.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Apache 1.3.x on Microsoft Windows</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.iis.html">Microsoft IIS / PWS</a></div> <div class="next" style="text-align: right; float: right;"><a href="install.windows.apache2.html">Apache 2.0.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.apache1" class="sect1"> <h2 class="title">Apache 1.3.x on Microsoft Windows</h2> <p class="para"> This section contains notes and hints specific to Apache 1.3.x installs of PHP on Microsoft Windows systems. There are also <a href="install.windows.apache2.html" class="link">instructions and notes for Apache 2</a> on a separate page. </p> <blockquote><p><b class="note">Note</b>: Please read the <a href="install.windows.manual.html" class="link">manual installation steps</a> first! <br /> </p></blockquote> <p class="simpara"> There are two ways to set up PHP to work with Apache 1.3.x on Windows. One is to use the CGI binary (<var class="filename">php.exe</var> for PHP 4 and <var class="filename">php-cgi.exe</var> for PHP 5), the other is to use the Apache Module DLL. In either case you need to edit your <var class="filename">httpd.conf</var> to configure Apache to work with PHP, and then restart the server. </p> <p class="simpara"> It is worth noting here that now the SAPI module has been made more stable under Windows, we recommend it's use above the CGI binary, since it is more transparent and secure. </p> <p class="simpara"> Although there can be a few variations of configuring PHP under Apache, these are simple enough to be used by the newcomer. Please consult the Apache Documentation for further configuration directives. </p> <p class="simpara"> After changing the configuration file, remember to restart the server, for example, <strong class="command">NET STOP APACHE</strong> followed by <strong class="command">NET START APACHE</strong>, if you run Apache as a Windows Service, or use your regular shortcuts. </p> <blockquote><p><b class="note">Note</b>: <span class="simpara">Remember that when addingpath values in the Apache configuration files on Windows, all backslashessuch as <var class="filename">c:\directory\file.ext</var> must be converted toforward slashes: <var class="filename">c:/directory/file.ext</var>. A trailingslash may also be necessary for directories.</span></p></blockquote> <div id="install.windows.apache1.module" class="sect2"> <h3 class="title">Installing as an Apache module</h3> <p class="para"> You should add the following lines to your Apache <var class="filename">httpd.conf</var> file: </p> <p class="para"> <div class="example"> <p><b>Example #1 PHP as an Apache 1.3.x module</b></p> <div class="example-contents"><p> This assumes PHP is installed to <var class="filename">c:\php</var>. Adjust the path if this is not the case. </p></div> <div class="example-contents"><p> For PHP 4: </p></div> <div class="example-contents"><div class="cdata"><pre># Add to the end of the LoadModule section# Don't forget to copy this file from the sapi directory!LoadModule php4_module "C:/php/php4apache.dll"# Add to the end of the AddModule sectionAddModule mod_php4.c</pre></div> </div> <div class="example-contents"><p> For PHP 5: </p></div> <div class="example-contents"><div class="cdata"><pre># Add to the end of the LoadModule sectionLoadModule php5_module "C:/php/php5apache.dll"# Add to the end of the AddModule sectionAddModule mod_php5.c</pre></div> </div> <div class="example-contents"><p> For both: </p></div> <div class="example-contents"><div class="cdata"><pre># Add this line inside the <IfModule mod_mime.c> conditional braceAddType application/x-httpd-php .php# For syntax highlighted .phps files, also addAddType application/x-httpd-php-source .phps</pre></div> </div> </div> </p> </div> <div id="install.windows.apache1.cgi" class="sect2"> <h3 class="title">Installing as a CGI binary</h3> <p class="para"> If you unzipped the PHP package to <var class="filename">C:\php\</var> as described in the <a href="install.windows.manual.html" class="link">Manual Installation Steps</a> section, you need to insert these lines to your Apache configuration file to set up the CGI binary: <div class="example"> <p><b>Example #2 PHP and Apache 1.3.x as CGI</b></p> <div class="example-contents"><div class="cdata"><pre>ScriptAlias /php/ "c:/php/"AddType application/x-httpd-php .php# For PHP 4Action application/x-httpd-php "/php/php.exe"# For PHP 5Action application/x-httpd-php "/php/php-cgi.exe"# specify the directory where php.ini isSetEnv PHPRC C:/php</pre></div> </div> </div> Note that the second line in the list above can be found in the actual versions of <var class="filename">httpd.conf</var>, but it is commented out. Remember also to substitute the <var class="filename">c:/php/</var> for your actual path to PHP. </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> <p class="simpara"> If you would like to present PHP source files syntax highlighted, there is no such convenient option as with the module version of PHP. If you chose to configure Apache to use PHP as a CGI binary, you will need to use the <a href="function.highlight-file.html" class="function">highlight_file()</a> function. To do this simply create a PHP script file and add this code: <i><?php highlight_file('some_php_script.php'); ?></i>. </p> </div> </div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="install.windows.iis.html">Microsoft IIS / PWS</a></div> <div class="next" style="text-align: right; float: right;"><a href="install.windows.apache2.html">Apache 2.0.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>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -