Netscape および iPlanet Enterprise サーバ

このセクションでは Sun SolarisWindowsの両方について、 PHPをNESまたはiPlanet Webサーバ用に構築する方法についてヒントを述べます。

http://benoit.noss.free.fr/php/install-php4.html にNetscape Enterprise Server(NES)上にPHPをセットアップするための より詳細な情報があります。

Sun Solaris上にNES/iPlanet/SunONE Webサーバー用のPHPをインストール する

PHPをNES/iPlanet/SunONE Webサーバ用に構築するには、オプション --with-nsapi=[DIR] に適当なインストールディレクトリを付けて指定して下さい。 デフォルトのディレクトリは、通常 /opt/netscape/suitespot/です。 /php-xxx-version/sapi/nsapi/nsapi-readme.txt も参照下さい。

  1. 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)

  2. パスが適切に設定され、 PATH=.:/usr/local/bin:/usr/sbin:/usr/bin:/usr/ccs/bin が含まれていることを確認して下さい。そして、システム上で export PATHとして、有効にしてください。

  3. gunzip php-x.x.x.tar.gz ( .gz 配布の場合には手順4へ)

  4. tar xvf php-x.x.x.tar

  5. PHPを展開したディレクトリに移動します cd ../php-x.x.x

  6. 以下の手順で行ってください。 /opt/netscape/suitespot/は netscapeサーバーをインストールした場所です。 必要ならパスを変更してください。
    ./configure --with-mysql=/usr/local/mysql \
    --with-nsapi=/opt/netscape/suitespot/ \
    --enable-libgcc

  7. makeの後make install を実行してください。

baseインストールを実行し、適当なreadmeファイルを読んだ後、いくつか の追加インストール手順を実行する必要があるかもしれません。

NES/iPlanet/SunONEの設定手順. まず、全ての共有ライブラリを見つけるためにSunONE用の環境変数 LD_LIBRARY_PATH にいくつかのパスを追加する必要があります。これらの 設定は、SunONE Webサーバの開始スクリプトで行うのが最善でしょう。 Windows ユーザは、おそらくこの手順をとばすことが可能です。 開始スクリプトは、通常以下の場所にあります。 /path/to/server/https-servername/start /path/to/server/https-servername/config/ にある設定ファイルを編集することも可能です。

  1. mime.typesに次の行を追加します。(管理用サー バーでこれを行うことができます。)
    type=magnus-internal/x-httpd-php exts=php

  2. magnus.conf (サーバー>= 6の場合)または obj.conf(サーバー< 6の場合) を編集し、 以下を追加して下さい。 shlib はシステムにより異なります。使用するOSがUNIXの場合、 /opt/netscape/suitespot/bin/libphp4.soのように なるでしょう。 mime型initの後に次の行を置く必要があります。
    Init fn="load-modules" funcs="php4_init,php4_execute,php4_auth_trans" shlib="/opt/netscape/suitespot/bin/libphp4.so"
    Init fn="php4_init" LateInit="yes" errorString="Failed to initialize PHP!" [php_ini="/path/to/php.ini"]
    (PHP >= 4.3.3) php_iniパラメータはオプショ ンですが、これを指定することにより、Webサーバーの設定ディレクト リにphp.iniを置くことができます。

  3. obj.confのデフォルトのオブジェクトを設定し ます。 (バーチャルサーバーの場合 vserver.obj.confの[SunONE 6.0]クラス)
    <object name="default">
    .
    .
    .
    .#NOTE この次の行は全ての'ObjectType'の後で、'AddLog'行の前とする必要があります
    Service fn="php4_execute" type="magnus-internal/x-httpd-php" [inikey=value inikey=value ...]
        . 
        . 
    </Object>
    (PHP >= 4.3.3) 追加のパラメータとして、いくつかの特別な php.ini-値を追加する ことができます。例えば、コンテキスト php4_executeをコールする時に docroot="/path/to/docroot" を設定 することができます。 論理値の場合、 "On","Off",...(これは正 しく動作しません)ではなく、0/1を値として使用して下さい。 例えば、 zlib.output_compression="On"ではな く、zlib.output_compression=1となります。

  4. 以下は、(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 が使用されているのを隠す際に有用です。

  5. 認証設定: PHP 認証は他の認証と併用することはできません。 "全ての認証は、PHPスクリプトに渡されます。" サーバ全体についてPHP認証を設定するには、以下の行を追加して下 さい。
    <Object name="default">
    AuthTrans fn=php4_auth_trans
    .
    .
    .
    </Object>

  6. PHP 認証を単一のディレクトリで行うには、次の行を追加します。
    <Object ppath="d:\path\to\authenticated\dir\*"> 
    AuthTrans fn=php4_auth_trans 
    </Object>

Windows上でNES/iPlanet/SunONにPHPをインストールする

PHPをCGIとしてインストールする場合には以下を行ってください。 (Netscape Enterprise Server, iPlanet, おそらくFastrackにも)

PHPをCGIとしてセットアップするためのより詳細な説明は http://benoit.noss.free.fr/php/install-php.html をご覧ください。

PHPをNSAPI(Netscape Enterprise Server, iPlanet, Fastrack用)としてインストールする場合は 以下のようにしてください。

PHPをNSAPIとしてセットアップするためのより詳細な説明は http://benoit.noss.free.fr/php/install-php4.html をご覧ください。

エラーページまたは独自のディレクトリリスト用の特別な使用法 (PHP >= 4.3.3)

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.

注意: But be warned: Support for nsapi_virtual() is EXPERIMENTAL!!!