運行環境:
Windows XP, ActivePerl-5.8.8.817-MSWin32-x86-257965.msi
安裝完畢,
用記事本打開apache的httpd.conf文件,
1.搜索cgi-bin,找到ScriptAlias /cgi-bin/
改成
ScriptAlias /cgi-bin/ "F:/Apache2/cgi-bin/",這是存放cgi文件的路徑
2. 搜索AddHandler 找到AddHandler cgi-script .cgi ,這是定義可執行cgi文件擴展名,可以把.cgi 改為 .pl 或加上”, .pl” ,成為“AddHandler cgi-script .pl ,.cgi“這樣兩個后綴都可以用了。
3.更改Options、Allow Override的參數為All。
改完之后象這樣:
#
# "F:/Apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "F:/Apache2/cgi-bin">
AllowOverride All
Options All
Order allow,deny
Allow from all
</Directory>
4.建立文件 test.pl , 內容如下:
#!d:/Perl/bin/perl
## 寫成!d:/Perl/bin/perl.exe也可以
## 注意,如果沒有第一行或寫錯,apache找不到perl解釋器
## ,會出現500 Internal Server
print "Content-type:text/html\n\n";
print "CGI執行成功!";
在F:\phpweb目錄下,建立一個html文件,內容如下:
<a 5. 重新啟動apache server,然后在瀏覽器打開這個文件,提示 “CGI執行成功!”
Windows XP, ActivePerl-5.8.8.817-MSWin32-x86-257965.msi
安裝完畢,
用記事本打開apache的httpd.conf文件,
1.搜索cgi-bin,找到ScriptAlias /cgi-bin/
改成
ScriptAlias /cgi-bin/ "F:/Apache2/cgi-bin/",這是存放cgi文件的路徑
2. 搜索AddHandler 找到AddHandler cgi-script .cgi ,這是定義可執行cgi文件擴展名,可以把.cgi 改為 .pl 或加上”, .pl” ,成為“AddHandler cgi-script .pl ,.cgi“這樣兩個后綴都可以用了。
3.更改Options、Allow Override的參數為All。
改完之后象這樣:

















在F:\phpweb目錄下,建立一個html文件,內容如下:
<a 5. 重新啟動apache server,然后在瀏覽器打開這個文件,提示 “CGI執行成功!”