【教學】Appserv + CGI



贊助商連結


simonyang
2003-03-11, 09:59 PM
此教學是用我剛剛才重新用 AppServ 架好的網站所寫成ㄉ...
所以應該沒問題啦.....

----------------------------------------------------------

注意: 以下兩個軟體如果不想安裝在我所指定的 D 槽, 也請安裝在同一個槽中, 例如 C:\ 下
但是 ActivePerl 的路徑請不要作修改, 也就是就算改安裝到 C:\ 下, 也必須安裝在
c:\usr\local 之下, 而 AppServ 則無此限制!!

----------------------------------------------------------

1. 下載並安裝 AppServ
軟體首頁: http://academic.cmri.ac.th/appserv/
下載路徑: http://appserv.sourceforge.net/downloads/appserv-win32-1.9.0.exe
安裝目錄: D:\AppServ

2. 下載並安裝 ActivePerl
軟體首頁: http://www.activestate.com/
下載路徑: http://downloads.activestate.com/ActivePerl/Windows/5.8/ActivePerl-5.8.0.805-MSWin32-x86.msi
安裝目錄: D:\usr\local

----------------------------------------------------------

安裝完畢後至 D:\AppServ\apache\conf 下修改 httpd.conf

尋找



#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname directory are treated as applications and
# run by the server when requested rather than as documents sent to the client.
# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
#
ScriptAlias /cgi-bin/ "C:/Program Files/Apache Group/Apache/cgi-bin/"


將 ScriptAlias /cgi-bin/ "C:/Program Files/Apache Group/Apache/cgi-bin/"

修改為 ScriptAlias /*/ "D:/AppServ/www"

接下來將



#
# "C:/Program Files/Apache Group/Apache/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "C:/Program Files/Apache Group/Apache/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>


修改為



<Directory "D:/AppServ/www">
AllowOverride All
Options All
Order allow,deny
Allow from all
</Directory>


----------------------------------------------------------

開啟 D:\AppServ\www\phpMyAdmin 並修改 config.inc.php


尋找



$cfg['PmaAbsoluteUri'] =


並將 '' (單引號) 內的字串修改為 http://localhost/phpMyAdmin

尋找



$cfg['Servers'][$i]['auth_type']


並將 '' (單引號) 內的字串修改為 http

尋找



$cfg['Servers'][$i]['user']


並將 '' (單引號) 內的字串修改為 安裝 AppServ 時安裝程式要求輸入的 MySQL 的帳號


尋找



$cfg['Servers'][$i]['password']


並將 '' (單引號) 內的字串修改為 安裝 AppServ 時安裝程式要求輸入的 MySQL 的密碼

----------------------------------------------------------

到此為止修改完畢!!

這些修改包括將 Apache 加入 CGI 的支援 以及 PHPMyAdmin 的登入安全問題的修改
且在 D:/AppServ/www 下的所有目錄下皆可執行 CGI 程式!!

PS. CGI 程式的前置命令為 #!/usr/local/bin/perl

這樣子即可使伺服器成為 Apache + PHP + CGI + PHPMyAdmin + MySQL 的系統了.....

祝大家安裝愉快阿^^