Chinaunix首页 | 论坛 | 博客
  • 博客访问: 323343
  • 博文数量: 25
  • 博客积分: 3090
  • 博客等级: 中校
  • 技术积分: 1305
  • 用 户 组: 普通用户
  • 注册时间: 2006-03-27 17:59
文章分类

全部博文(25)

文章存档

2012年(1)

2011年(1)

2010年(4)

2009年(5)

2008年(14)

我的朋友

分类:

2008-09-08 13:51:12

用记事本打开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.
#
"F:/Apache2/cgi-bin">
     AllowOverride All
     Options All
     Order allow
,deny
     Allow from all
4.建立文件 test.pl , 内容如下:

#!c:/Perl/bin/perl
#
#    写成!c:/Perl/bin/perl.exe也可以
#
# 注意,如果没有第一行或写错,apache找不到perl解释器
#
# ,会出现500 Internal Server
print "Content-type:text/html\n\n";
print "CGI执行成功!";

在F:\phpweb目录下,建立一个html文件,内容如下:
CGI
5. 重新启动apache server,然后在浏览器打开这个文件,提示 “CGI执行成功!”
阅读(1089) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~