[分享]win2k pro+apache執行CGI的方法 - PCZONE 討論區

返回   PCZONE 討論區 > ▲ -- 電 腦 軟 體 討 論 區 > -- 網 路 軟 體 討 論 二 版 (網路其他軟體)


PCZONE 討論區



通知

-- 網 路 軟 體 討 論 二 版 (網路其他軟體) 包括檔案傳輸和下載、網頁搜尋、網路工具、聊天、多媒體、架站軟體、線上字典等的疑難解答。

會員
[分享]win2k pro+apache執行CGI的方法
一、先去 ActiveState 下載perl安裝套件

二、編輯apache\conf\httpd.conf這個檔案

三、找到 #AddModule mod_include.c mod_autoindex.c mod_dir.c mod_cgi.c mod_userdir.c
將前面的#去掉

四、找到 #!/usr/bin/perl 將他改成改成你的perl安裝目錄,例如 #!e:/perl/bin/perl.exe

五、找到
#
# "G:/Apache/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "E:/www/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
改成
#
# "G:/Apache/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "E:/www/cgi-bin">
AllowOverride None
Options +ExecCGI
Order allow,deny
Allow from all
</Directory>

如果要讓別的使用者使用,只要在這段下面加上
<Directory "E:/www/nightmare/cgi-bin">
AllowOverride None
Options +ExecCGI
Order allow,deny
Allow from all
</Directory>
E:/www/nightmare/cgi-bin是其他使用者的cgi-bin目錄
記得要放在</IfModule>這行的前面

六、找到這段
# AddHandler allows you to map certain file extensions to "handlers",
# actions unrelated to filetype. These can be either built into the server
# or added with the Action command (see below)
#
# If you want to use server side includes, or CGI outside
# ScriptAliased directories, uncomment the following lines.
#
# To use CGI scripts:
#
將 #AddHandler cgi-script .cgi 前面的#去掉並改成 AddHandler cgi-script .pl .cgi

七、將你要執行的perl檔案,例如安裝完ActiveState後有個printenv.pl,內容是
#!/usr/local/bin/perl
##
## printenv -- demo CGI program which just prints its environment
##

print "Content-type: text/plain\n\n";
foreach $var (sort(keys(%ENV))) {
$val = $ENV{$var};
$val =~ s|\n|\\n|g;
$val =~ s|"|\\"|g;
print "${var}=\"${val}\"\n";
}
將第一行改成你放perl.exe的位置,例如本範例中我的perl.exe位置是e:/perl/bin/perl.exe
那就要改成
#!e:\perl\bin\perl.exe

八、重新啟動apache

九、完成...打入你自己的網址,例如http://localhost/cgi-bin/printenv.pl去測試看看吧..

我用過cgi,perl,apache在PCZONE上搜尋過,都沒找到類似的文章...
如果有重複發表,還請大家多多見諒...
我是Apache的新手,如果這篇發表有任何需要改正的地方或是有更高階的方法,還請各位前輩多多發表自己的意見

回覆
會員

那有沒有win2k service + iis5.0執行CGI的方法呢
看了個大論壇及討論區
好像都沒有這類的討論及教學
而這一個網站
ActiveState下載的地方卻寫
Windows 2000, XP: No additional requirements
是不是w2k+iis5.0沒法跑cgi
一定要linux才可以
還是有內建了
那麼執行路徑呢~

回覆


類似的主題
主題 主題作者 討論版 回覆 最後發表
Win2k PRO 升級IDE導致藍色螢幕 Gino1 -- Windows 討 論 版 3 2002-04-28 03:04 PM
about win2k pro outch -- Windows 討 論 版 7 2002-03-27 09:21 PM
請問一下~ win2k pro 的 我的最愛... chunping -- Windows 討 論 版 2 2002-01-23 07:46 PM
如何Ghost Win2K Pro ?? casperyang -- Windows 討 論 版 4 2002-01-04 02:20 PM
Win2k On AOpen AX64 Pro (VIA Apollo Pro 133A) neighbor -- 電 腦 硬 體 討 論 版 1 2001-07-18 10:13 PM






 XML   RSS 2.0   RSS 
本站使用 vBulletin 合法版權程式
站務信箱 : [email protected]

本論壇所有文章僅代表留言者個人意見,並不代表本站之立場,討論區以「即時留言」方式運作,故無法完全監察所有即時留言,若您發現文章可能有異議,請 email :[email protected] 處理。