-
Notifications
You must be signed in to change notification settings - Fork 59
/
apache2.xml
164 lines (149 loc) · 5.49 KB
/
apache2.xml
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
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: d73d69f40ee1a21f1ae6eb9fe19bc6fa53995bf3 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>
¬e.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>
これで、拡張子 .php のファイルは 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
-->