1
0
mirror of https://github.com/php/doc-ja.git synced 2026-03-24 07:02:08 +01:00
Files
archived-doc-ja/install/windows/apache2.xml
2024-12-08 18:21:17 +09:00

165 lines
5.5 KiB
XML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 2871f7103c7cfcfd95db64eb0930085965fd9330 Maintainer: mumumu Status: ready -->
<sect1 xml:id="install.windows.apache2" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Apache 2.x Microsoft Windows 用)</title>
<para>
このセクションでは、Microsoft Windows 上の Apache 2.x で PHP
をインストールする場合の説明とヒントを記しています。
</para>
<note>
<para>
まず始めに、
<link linkend="install.windows.manual">マニュアルインストールの手順</link>
をお読みください。
</para>
</note>
<para>
<link xlink:href="&url.apache2.docs;">Apache ドキュメンテーション</link>
を参照し、Apache 2.x サーバーの基本を理解しておくことを強く推奨します。
また、以下の解説を読む前に、Apache 2.x に関する
<link xlink:href="&url.apache2.windows;">Windows 固有の情報</link>
についても参照するとよいでしょう。
</para>
<para>
最新の <link xlink:href= "&url.apachelounge.download;">Apache 2.x</link> と、
対応するバージョンの PHP をダウンロードしてください。
<link linkend="install.windows.manual">マニュアルインストールの手順</link>
を実施したら、引き続き以下のとおり PHP と Apache の設定を行ってください。
</para>
<para>
PHP を Windows 上の Apache 2.x で動かすには三通りの方法があります。
PHP をハンドラとして動かす方法、CGI として動かす方法、そして
FastCGI で動かす方法です。
</para>
&note.apache.slashes;
<sect2 xml:id="install.windows.apache2.module">
<title>Apache ハンドラとしてインストール</title>
<para>
Apache 2.x 用の PHP モジュールを読み込むには、
以下の行を Apache 設定ファイル &httpd.conf; に追加しなければいけません:
<example>
<title>PHP を Apache 2.x ハンドラとして使う設定</title>
<programlisting role="apache-conf">
<![CDATA[
# PHP 8.0.0 より前のバージョンでは、モジュール名は 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>
上の例の <filename>C:/php/</filename>
は実際のパスにあわせて修正してください。
<literal>LoadModule</literal> ディレクティブで
PHP 7 の場合 <filename>php7apache2_4.dll</filename> を、
PHP 8 の場合 <filename>php8apache2_4.dll</filename> を使うことに注意し、
指定したファイルが実際にその場所にあるかどうかを忘れずに確認しましょう。
</simpara>
</note>
</sect2>
<sect2 xml:id="install.windows.apache2.cgi">
<title>CGI として PHP を実行させる</title>
<para>
<link xlink:href="&url.apache.cgi;">Apache CGI
ドキュメント</link> を読み、Apache 上の CGI について理解しておきましょう。
</para>
<para>
PHP を CGI として実行するには、ScriptAlias
ディレクティブで CGI ディレクトリとして指定した場所に
php-cgi ファイルを置かなければなりません。
</para>
<para>
さらに、PHP ファイルに <literal>#!</literal> の行を追加して
PHP バイナリの場所を指定しなければなりません:
<example>
<title>PHP を Apache 2.x 上で 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>PHP を FastCGI で実行する</title>
<para>
PHP を FastCGI で動かすことは、
CGI として動かすのにくらべると多くの利点があります。
設定方法は単純明快です。
</para>
<para>
まず mod_fcgid を
<link xlink:href="&url.apachelounge.download;">&url.apachelounge;</link>
から取得します。Win32 用のバイナリがこのサイトからダウンロードできます。
そして、説明に従ってモジュールをインストールしましょう。
</para>
<para>
次にウェブサーバーを以下のように設定します。
パスの部分は適切に変更し、インストールするシステム上の環境にあわせましょう:
<example>
<title>PHP を FastCGI として動かす Apache の設定</title>
<programlisting>
<![CDATA[
LoadModule fcgid_module modules/mod_fcgid.so
# Where is your php.ini file?
FcgidInitialEnv PHPRC "c:/php"
<FilesMatch \.php$>
SetHandler fcgid-script
</FilesMatch>
FcgidWrapper "c:/php/php-cgi.exe" .php
]]>
</programlisting>
</example>
これで、拡張子 <literal>.php</literal> のファイルは PHP FastCGI
ラッパーが処理するようになります。
</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
-->