[ 永遠的UNIX::UNIX技術資料的寶庫 ]   GB | BIG5

首頁 > 編程技術 > Php > 正文
在Netscape Enterprise Server 3.x下配置PHP
本文出自:http://phpuser.com 作者: polaris(php@yeah.net) (2002-10-14 06:02:00)

一、基本原理

Netscape Enterprise Server以兩種方式執行CGI程序.

  • 指定一僅包含CGI程序的目錄,所有在該目錄下的程序不管是是什綴名都被執行
  • 指定以某種綴名結尾的程序均為CGI程序,放在服務器的任何位置都會被執行,PHP程序以該方式執行。

在mime.types中包含magnus-internal/cgi bat,cgi,exe,這告訴Netscape Enterprise Server綴名為bat,cgi,exe的程序其類型為magnus-internal/cgi,但默認情況下如果這些程序不放在指定的CGI程序目錄下Netscape Enterprise Server將不會執行它們。可以通過Netscape Enterprise Server Manager|Progams|CGI File Type,把Activate CGI as a file type選為Yes,然Save and apply即可。這樣以bat,cgi,exe結尾的程序放在任何地方都會被執行。

實際上手工在obj.conf文件中添加
Service type="magnus-internal/cgi" fn="send-cgi"
即可。

在Netscape Enterprise Server上執行PHP程序需要一plugin程序模塊,在啟動Netscape Enterprise Server時
會啟動該模塊,當客戶端請求PHP程序時該模塊會告訴Netscape Enterprise Server,這是個magnus-internal/cgi
類型的文件,因此該PHP程序就被執行。

為實現以上功能,在obj.conf文件中加入
Init fn="load-modules" funcs="redirect-cgi" \
shlib="/opt/local/suitespot-3.0/plugins/redirect/redirect_cgi.so" NativeThread="no"
在啟動Netscape Enterprise Server時啟動該模塊。

ObjectType fn="redirect-cgi" cgi_path="/opt/local/www/cgi-bin/php" type="magnus-internal/php"
通過先前啟動的plugin模塊告訴Netscape Enterprise Server,類型為magnus-internal/php的文件,
需通過/opt/local/www/cgi-bin/php來解釋執行。

在mime.types中加入一行
magnus-internal/php php3,phtml
,Netscape Enterprise Server就知道如何處理綴名為php3,phtml的文件了。

二、具體實現步驟:

  1. http://www.webgenx.com/php/phpnes.php3下載原程序,參考$NETSCAPE_HOME/nsapi/examples目錄下的Makefile文件,編譯生成redirect_cgi.so文件。
  2. 把該文件放置在某一目錄下,例如:/opt/local/suitespot-3.0/plugins/redirect/redirect_cgi.so。
  3. 修改mime.types文件加入magnus-internal/php php3,phtml。
  4. 修改obj.conf,在其它的Init-directives,加入
    Init fn="load-modules" funcs="redirect-cgi" \
    shlib="/opt/local/suitespot-3.0/plugins/redirect/redirect_cgi.so" NativeThread="no"
  5. 修改obj.conf
    在ObjectType fn="type-by-extension"和ObjectType fn="force-type" type="text/plain"間加入:
    ObjectType fn="redirect-cgi" cgi_path="/opt/local/www/cgi-bin/php" type="magnus-internal/php"。
  6. 修改obj.conf
    在ObjectType fn="force-type" type="text/plain"和
    Service method="(GET|HEAD)" type="magnus-internal/imagemap" fn="imagemap"間加入
    Service type="magnus-internal/cgi" fn="send-cgi"。
  7. 把編譯生成的php文件放在/opt/local/www/cgi-bin目錄下。

完成重新啟動Netscape Enterprise Server即可。


(http://www.fanqiang.com)
    進入【UNIX論壇

相關文章
 

★  樊強制作 歡迎分享  ★