Changes to reflect bug #29694. Also reworded and reorganised instructions.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@169431 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Aidan Lister 2004-09-28 12:00:49 +00:00
parent 275afce45d
commit 90a922b8fd

View file

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.12 $ -->
<!-- $Revision: 1.13 $ -->
<sect1 id="install.windows.apache1">
<title>Apache 1.3.x on Microsoft Windows</title>
<para>
This section contains notes and hints specific to Apache 1.3.x installs
of PHP on Microsoft Windows systems. We also
have <link linkend="install.windows.apache2">instructions and notes
for Apache 2 on a separate page</link>.
of PHP on Microsoft Windows systems. There are also
<link linkend="install.windows.apache2">instructions and notes
for Apache 2</link> on a separate page.
</para>
<note>
<para>
You should read the <link linkend="install.windows.manual">manual
installation steps</link> first!
Please read the <link linkend="install.windows.manual">manual
installation steps</link> first!
</para>
</note>
@ -19,7 +19,7 @@
There are two ways to set up PHP to work with Apache 1.3.x
on Windows. One is to use the CGI binary (<filename>php.exe</filename>
for PHP 4 and <filename>php-cgi.exe</filename> for PHP 5),
the other is to use the Apache module DLL. In either case
the other is to use the Apache Module DLL. In either case
you need to edit your &httpd.conf; to configure Apache to
work with PHP, and then restart the server.
</simpara>
@ -54,42 +54,66 @@
<para>
<example>
<title>PHP as an Apache 1.3.x module</title>
<para>
This assumes PHP is installed to <filename>c:\php</filename>. Adjust the
path if this is not the case.
</para>
<para>
For PHP 4:
</para>
<programlisting role="apache-conf">
<![CDATA[
AddType application/x-httpd-php .php
# For PHP 4
# Add to the end of the LoadModule section
LoadModule php4_module "c:/php/sapi/php4apache.dll"
# For PHP 5
# Add to the end of the AddModule section
AddModule mod_php4.c
]]>
</programlisting>
<para>
For PHP 5:
</para>
<programlisting role="apache-conf">
<![CDATA[
# Add to the end of the LoadModule section
LoadModule php5_module "c:/php/php5apache.dll"
# specify the directory where php.ini is
SetEnv PHPRC C:/php
# Add to the end of the AddModule section
AddModule mod_php5.c
]]>
</programlisting>
<para>
For both:
</para>
<programlisting role="apache-conf">
<![CDATA[
# Add this line inside the <IfModule mod_mime.c> conditional brace
AddType application/x-httpd-php .php
# For syntax highlighted .phps files, also add
AddType application/x-httpd-php-source .phps
]]>
</programlisting>
</example>
</para>
<simpara>
You may find after using the Windows installer for Apache that you need
to define the <literal>AddModule</literal> directive for
<filename>mod_php4.c</filename>. This is especially important if the
<literal>ClearModuleList</literal> directive is defined, which you will
find by scrolling down a few lines. You will see a list of
<literal>AddModule</literal> entries, add the following line
<emphasis>at the end</emphasis> of the list: <literal>AddModule
mod_php4.c</literal>. For PHP 5, instead use <literal>AddModule
mod_php5.c</literal>
</simpara>
<simpara>
If you would like to use the source code highlighting feature, you need
to add the following line to your &httpd.conf;:
<literal>AddType application/x-httpd-php-source .phps</literal>.
This should be inserted at the same place where you inserted
<literal>AddType application/x-httpd-php .php</literal> above). With
this setup, all files served with the <literal>.phps</literal> extension
will be syntax highlighted for the browser.
</simpara>
<para>
PHP will first search for &php.ini; in the directory defined by the
<constant>PHPRC</constant> system enviroment variable. Failing to find
it there, it will search the Windows system directory, then the Apache folder.
</para>
<tip>
<title>Setting the <constant>PHPRC</constant> Enviroment Variable:</title>
<para>
Right-click <literal>My Computer</literal> and select <literal>Properties</literal>.
Click <literal>Advanced</literal>, then <literal>Enviroment Variables</literal>.
Under <literal>System Variables</literal>, select <literal>New</literal>.
Name the variable <literal>PHPRC</literal>, with the value of
<filename>c:\php</filename> (or the directory containing your &php.ini;).
The computer will need to be rebooted to take effect.
</para>
</tip>
</sect2>
<sect2 id="install.windows.apache1.cgi">
@ -129,11 +153,9 @@ SetEnv PHPRC C:/php
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 <function>show_source</function> function. To
will need to use the <function>highlight_file</function> function. To
do this simply create a PHP script file and add this code:
<literal>&lt;?php show_source("original_php_script.php"); ?&gt;</literal>.
Substitute <filename>original_php_script.php</filename> with
the name of the file you wish to show the source of.
<literal>&lt;?php highlight_file('some_php_script.php'); ?&gt;</literal>.
</simpara>
</sect2>