1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
|
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<sect1 xml:id="install.windows.apache2" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Installation for Apache 2.x on Windows systems</title>
<para>
This section contains notes and hints specific to Apache 2.x installs
of PHP on Microsoft Windows systems.
</para>
<note>
<para>
Please read the <link linkend="install.windows.manual">manual
installation steps</link> first!
</para>
</note>
<para>
It is strongly recommended to consult the
<link xlink:href="&url.apache2.docs;">Apache Documentation</link>
to get have a basic understanding of the Apache 2.x Server.
Also consider reading the
<link xlink:href="&url.apache2.windows;">Windows specific notes</link>
for Apache 2.x before reading on here.
</para>
<para>
Download the most recent version of
<link xlink:href= "&url.apachelounge.download;">Apache 2.x</link>
and a fitting PHP version. Follow the
<link linkend="install.windows.manual">Manual Installation Steps</link>
and come back to go on with the integration of PHP and Apache.
</para>
<para>
There are three ways to set up PHP to work with Apache 2.x on Windows.
PHP can be run as a handler, as a CGI, or under FastCGI.
</para>
¬e.apache.slashes;
<sect2 xml:id="install.windows.apache2.module">
<title>Installing as an Apache handler</title>
<note>
<simpara>
When using the apache2handler SAPI, the Thread Safe (TS) version of
PHP must be used.
</simpara>
</note>
<para>
To load the PHP module for Apache 2.x, the following lines in the
Apache &httpd.conf; configuration file must be inserted:
<example>
<title>PHP and Apache 2.x as handler</title>
<programlisting role="apache-conf">
<![CDATA[
# before PHP 8.0.0 the name of the module was php7_module
LoadModule php_module "c:/php/php8apache2_4.dll"
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
# configure the path to php.ini
PHPIniDir "C:/php"
]]>
</programlisting>
</example>
</para>
<note>
<simpara>
The actual path to PHP must be substituted instead of
<filename>C:/php/</filename> in the above examples.
Make sure that the file referenced in the <literal>LoadModule</literal> directive is at
the specified location. Use <filename>php7apache2_4.dll</filename>
for PHP 7, or <filename>php8apache2_4.dll</filename> for PHP 8.
</simpara>
</note>
</sect2>
<sect2 xml:id="install.windows.apache2.cgi">
<title>Running PHP as CGI</title>
<para>
It is strongly recommended to consult the
<link xlink:href="&url.apache.cgi;">Apache CGI documentation</link>
for a more complete understanding of running CGI on Apache.
</para>
<para>
To run PHP as CGI, the php-cgi files will need to be placed in a
directory designated as a CGI directory using the ScriptAlias directive.
</para>
<para>
A <literal>#!</literal> line will need to be placed in the PHP files,
which point to the location of the PHP binary:
<example>
<title>PHP and Apache 2.x as CGI</title>
<programlisting>
<![CDATA[
#!C:/php/php.exe
<?php
phpinfo();
?>
]]>
</programlisting>
</example>
</para>
&warn.install.cgi;
</sect2>
<sect2 xml:id="install.windows.apache2.fastcgi">
<title>Running PHP under FastCGI</title>
<para>
Running PHP under FastCGI has a number of advantages over running it as a
CGI. Setting it up this way is fairly straightforward:
</para>
<para>
Obtain <literal>mod_fcgid</literal> from
<link xlink:href="&url.apachelounge.download;">&url.apachelounge;</link>.
Win32 binaries are available for download from that site.
Install the module according to the instructions that will come with it.
</para>
<para>
Configure the web server as shown below, taking care to adjust any paths
to reflect how it is installed on the system:
<example>
<title>Configure Apache to run PHP as FastCGI</title>
<programlisting>
<![CDATA[
LoadModule fcgid_module modules/mod_fcgid.so
# Where is the php.ini file?
FcgidInitialEnv PHPRC "c:/php"
<FilesMatch \.php$>
SetHandler fcgid-script
</FilesMatch>
FcgidWrapper "c:/php/php-cgi.exe" .php
]]>
</programlisting>
</example>
Files with a <literal>.php</literal> extension will now be executed by the PHP FastCGI
wrapper.
</para>
</sect2>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
|