このセクションでは
Sun Solarisと
Windowsの両方について、
PHPをNESまたはiPlanet Webサーバ用に構築する方法についてヒントを述べます。
http://benoit.noss.free.fr/php/install-php4.html
にNetscape Enterprise Server(NES)上にPHPをセットアップするための
より詳細な情報があります。
PHPをNES/iPlanet/SunONE Webサーバ用に構築するには、オプション
--with-nsapi=[DIR]
に適当なインストールディレクトリを付けて指定して下さい。
デフォルトのディレクトリは、通常 /opt/netscape/suitespot/です。
/php-xxx-version/sapi/nsapi/nsapi-readme.txt
も参照下さい。
http://www.sunfreeware.com/
または他のダウンロードサイトから以下の
パッケージをダウンロードしインストールします。
| autoconf-2.13 |
| automake-1.4 |
| bison-1_25-sol26-sparc-local |
| flex-2_5_4a-sol26-sparc-local |
| gcc-2_95_2-sol26-sparc-local |
| gzip-1.2.4-sol26-sparc-local |
| m4-1_4-sol26-sparc-local |
| make-3_76_1-sol26-sparc-local |
|
mysql-3.23.24-beta (if you want mysql support)
|
| perl-5_005_03-sol26-sparc-local |
| tar-1.13 (GNU tar) |
パスが適切に設定され、
PATH=.:/usr/local/bin:/usr/sbin:/usr/bin:/usr/ccs/bin
が含まれていることを確認して下さい。そして、システム上で
export PATHとして、有効にしてください。
gunzip php-x.x.x.tar.gz
( .gz 配布の場合には手順4へ)
tar xvf php-x.x.x.tar
PHPを展開したディレクトリに移動します
cd ../php-x.x.x
以下の手順で行ってください。
/opt/netscape/suitespot/は
netscapeサーバーをインストールした場所です。
必要ならパスを変更してください。
./configure --with-mysql=/usr/local/mysql \
--with-nsapi=/opt/netscape/suitespot/ \
--enable-libgcc |
makeの後make install
を実行してください。
baseインストールを実行し、適当なreadmeファイルを読んだ後、いくつか
の追加インストール手順を実行する必要があるかもしれません。
PHPをCGIとしてインストールする場合には以下を行ってください。
(Netscape Enterprise Server, iPlanet, おそらくFastrackにも)
php4ts.dllをシステムルートにコピー
(Windowsがインストールされているディレクトリ)
コマンドラインからファイルの関連付けを行います。
次の2行をタイプしてください:
assoc .php=PHPScript
ftype PHPScript=c:\php\php.exe %1 %* |
Netscape Enterprise Administration Server はダミーのshellcgiディ
レクトリを作成し、その後すぐに削除します。
(このステップでは5つの重要な行がobj.confに作成され、
Webサーバがshellcgiスクリプトを扱えるようになります)
Netscape Enterprise Administration Serverにおいて
新しいmime typeを作成します (Category: type,
Content-Type: magnus-internal/shellcgi, File Suffix:php)
PHPを実行する全てのWebサーバーインスタンスで行ってください。
PHPをCGIとしてセットアップするためのより詳細な説明は
http://benoit.noss.free.fr/php/install-php.html
をご覧ください。
PHPをNSAPI(Netscape Enterprise Server,
iPlanet, Fastrack用)としてインストールする場合は
以下のようにしてください。
php4ts.dllをシステムルートにコピー
(Windowsがインストールされているディレクトリ)
コマンドラインからファイルの関連付けを行います。
次の2行をタイプしてください:
assoc .php=PHPScript
ftype PHPScript=c:\php\php.exe %1 %* |
Netscape Enterprise Administration Serverにおいて
新しいmime typeを作成します (Category: type,
Content-Type: magnus-internal/shellcgi, File Suffix:php)
magnus.conf (サーバー>= 6の場合) または
obj.conf (サーバー< 6の場合)を編集し、
以下を追加して下さい。
この行をmime types initの後に記述する必要があります。
Init fn="load-modules" funcs="php4_init,php4_execute,php4_auth_trans" shlib="c:/php/sapi/php4nsapi.dll"
Init fn="php4_init" LateInit="yes" errorString="Failed to initialise PHP!" [php_ini="c:/path/to/php.ini"] |
(PHP >= 4.3.3)
php_iniパラメータはオプションですが、これを指
定することにより、Webサーバーの設定ディレクトリに
php.iniを置くことができます。
Configure the default object in
obj.confのデフォルトオブジェクトを設定して下
さい。
(仮想サーバーの場合、vserver.obj.confのクラ
ス[SunONE 6.0])
< Object name="default" >セクションに
次の行を追加してください。この行は、
'ObjectType'の後、'AddLog'の前に記述して下さい。
Service fn="php4_execute" type="magnus-internal/x-httpd-php" |
(PHP >= 4.3.3)
追加のパラメータとして、いくつかの特別な php.ini-値を追加する
ことができます。例えば、コンテキスト
php4_executeをコールする時に
docroot="/path/to/docroot" を設定
することができます。
論理値の場合、
"On","Off",...(これは正
しく動作しません)ではなく、0/1を値として使用して下さい。
例えば、
zlib.output_compression="On"ではな
く、zlib.output_compression=1となります。
以下は、(cgi-binディレク
トリのように)PHPスクリプトのみからなるディレクトリを設定したい
場合のみ必要です。
<Object name="x-httpd-php">
ObjectType fn="force-type" type="magnus-internal/x-httpd-php"
Service fn=php4_execute [inikey=value inikey=value ...]
</Object> |
これにより、Administrationサーバーの特定のディレクトリを設定し、
これをスタイルx-httpd-phpに割り付けることができ
ます。このディレクトリの中にある全てのファイルはPHPスクリプトと
して実行されます。
これは、ファイルの名前を.htmlに変更し、PHP
が使用されているのを隠す際に有用です。
Webサービスを再起動して設定を反映します
PHPを実行する全てのWebサーバーインスタンスで行ってください。
PHPをNSAPIとしてセットアップするためのより詳細な説明は
http://benoit.noss.free.fr/php/install-php4.html
をご覧ください。
You can use PHP to generate the error pages for "404 Not Found"
or similar. Add the following line to the object in obj.conf for
every error page you want to overwrite:
Error fn="php4_execute" code=XXX script="/path/to/script.php" [inikey=value inikey=value...] |
where
XXX ist the HTTP error code. Please delete any other
Error
directives which could interfere with yours.
If you want to place a page for all errors that could exist, leave
the
code parameter out. Your script can get the HTTP status code
with
$_SERVER['ERROR_TYPE'].
Another posibility is to generate self-made directory listings.
Just create a PHP script which displays a directory listing and
replace the corresponding default Service line for
type="magnus-internal/directory" in obj.conf with the following:
Service fn="php4_execute" type="magnus-internal/directory" script="/path/to/script.php" [inikey=value inikey=value...] |
For both error and directory listing pages the original URI and
translated URI are in the variables
$_SERVER['PATH_INFO'] and
$_SERVER['PATH_TRANSLATED'].
nsapi_virtual()およびサブリクエストに関する注意
(PHP >= 4.3.3)
The NSAPI module now supports the nsapi_virtual() function
(alias: virtual())
to make subrequests on the webserver and insert the result in the webpage.
The problem is, that this function uses some undocumented features from
the NSAPI library.
Under Unix this is not a problem, because the module automatically looks
for the needed functions and uses them if available. If not, nsapi_virtual()
is disabled.
Under Windows limitations in the DLL handling need the use of a automatic
detection of the most recent ns-httpdXX.dll file. This is tested for servers
till version 6.0. If a newer version of the SunONE server is used, the detection
fails and nsapi_virtual() is disabled.
If this is the case, try the following:
Add the following parameter to php4_init in
magnus.conf/obj.conf:
Init fn=php4_init ... server_lib="ns-httpdXX.dll" |
where
XX is the correct DLL version number. To get it, look in the server-root
for the correct DLL name. The DLL with the biggest filesize is the right one.
You can check the status by using the phpinfo() function.