mirror of
https://github.com/php/doc-en.git
synced 2026-03-24 07:42:10 +01:00
167 lines
4.8 KiB
XML
167 lines
4.8 KiB
XML
<?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
|
|
-->
|