apache下运行cgi模式的配置方法
1、apache下载地址:http://www.apache.org,下面以2.0.63为例介绍运行CGI程序的配置。
2、下载Windows下的Perl解释器ActivePerl,官方网站:http://www.activestate.com/,最新版本ActivePerl- 5.10.0.1003,假设安装路径为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、启动apache服务器,打开浏览器,输入http://localhost/cgi-bin/hello.pl
结果显示: Hello World
相关推荐
crazywdy 2007-06-24
习之北 2011-05-23
amberom 2020-07-04
Skyline 2020-06-25
王志龙 2020-06-14
afengxg 2020-06-09
jkzyx 2020-04-25
aaLiweipeng 2020-04-25
poplpsure 2020-02-01
chongtianfeiyu 2020-01-11
zyyjay 2020-01-08
gongjiang 2019-09-18
stoneechogx 2019-11-13
striver0 2011-03-09
aluminiumfoil 2011-09-08
启明星辰 2011-08-11
iPro 2011-04-12
其实我是一演员 2011-01-09