このセクションでは 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ファイルを読んだ後、いくつか の追加インストール手順を実行する必要があるかもしれません。
NES/iPlanet/SunONEの設定手順. まず、全ての共有ライブラリを見つけるためにSunONE用の環境変数 LD_LIBRARY_PATH にいくつかのパスを追加する必要があります。これらの 設定は、SunONE Webサーバの開始スクリプトで行うのが最善でしょう。 Windows ユーザは、おそらくこの手順をとばすことが可能です。 開始スクリプトは、通常以下の場所にあります。 /path/to/server/https-servername/start /path/to/server/https-servername/config/ にある設定ファイルを編集することも可能です。
mime.typesに次の行を追加します。(管理用サー バーでこれを行うことができます。)
type=magnus-internal/x-httpd-php exts=php |
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"] |
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> |
以下は、(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> |
認証設定: PHP 認証は他の認証と併用することはできません。 "全ての認証は、PHPスクリプトに渡されます。" サーバ全体についてPHP認証を設定するには、以下の行を追加して下 さい。
<Object name="default"> AuthTrans fn=php4_auth_trans . . . </Object> |
PHP 認証を単一のディレクトリで行うには、次の行を追加します。
<Object ppath="d:\path\to\authenticated\dir\*"> AuthTrans fn=php4_auth_trans </Object> |
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"] |
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" |
以下は、(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> |
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...] |
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...] |
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" |
You can check the status by using the phpinfo() function.
注意: But be warned: Support for nsapi_virtual() is EXPERIMENTAL!!!