apache下運(yùn)行cgi模式的配置方法
1、apache下載地址:http://www.apache.org,下面以2.0.63為例介紹運(yùn)行CGI程序的配置。
2、下載Windows下的Perl解釋器ActivePerl,官方網(wǎng)站:http://www.activestate.com/,最新版本ActivePerl- 5.10.0.1003,假設(shè)安裝路徑為c:\Perl。
3、修改apache的配置文件httpd.conf:
<Directory "D:/Apache Group/Apache2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
#AddHandler cgi-script .cgi
改為:
<Directory "D:/Apache Group/Apache2/cgi-bin">
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
</Directory>
AddHandler cgi-script .cgi .pl
4、編寫perl腳本程序hello.pl
#!C:\Perl\bin\perl.exe
print "content-type: text/html","\n\n";
print "<HTML>","\n";
print "<HEAD>","\n";
print "<TITLE>Perl</TITLE>","\n";
print "</HEAD>","\n";
print "<BODY>","\n";
print "<H1>Hello World</H1>","\n";
print "</BODY>","\n";
print "</HTML>","\n";
將程序拷貝到apache安裝目錄下cgi-bin文件夾下
5、啟動(dòng)apache服務(wù)器,打開瀏覽器,輸入http://localhost/cgi-bin/hello.pl
結(jié)果顯示: Hello World
相關(guān)文章
LNMP下安裝Pureftpd開啟FTP服務(wù)以及修改FTP端口的方法
這篇文章主要介紹了LNMP下安裝Pureftpd開啟FTP服務(wù)以及修改FTP端口的方法,需要的朋友可以參考下2016-09-09
解決atd服務(wù)報(bào)錯(cuò)Failed with result‘exit-code‘問題
在isoftserveros-v5.1-oe1-aarch64系統(tǒng)中,安裝at軟件包后,由于手動(dòng)執(zhí)行導(dǎo)致atd守護(hù)進(jìn)程出錯(cuò),通過查看后臺(tái)Process行,手動(dòng)kill原atd進(jìn)程,使用systemctl重啟atd服務(wù)后,問題得以解決,此經(jīng)驗(yàn)可為類似情況提供參考2024-09-09

