免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5314 | 回复: 6
打印 上一主题 下一主题

请教perl语言和apache下CGI调试环境?? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-11-10 21:04 |只看该作者 |倒序浏览
我在c:\Apache2.2\下安装了apache
在D:\Perl\下安装了PERL for win32
在IE里输入http:192.168.1.3  ()
网页可打开简单的网页
问题是打开网页利用perl调用另一个网页,就是打不开?
我打我的例子上传给大家看看
http://192.168.1.3/test.htm在C:\Apache2.2\htdocs\下
<html>
<title>你的第一个perl测试程序</title>
<body>
<h1>你的第一个perl测试程序<h1><br>
<h2>win 平台的环境变量测试</h2><br>
<form method="get" acton="http://192.168.1.3/cgi-bin/env.pl">
<input type=submit value="查看CGI环境变量">
</form>
</body>
</html>


下面是CGI程序,在C:\Apache2.2\cgi-bin\下
#!d:\Perl\bin\perl.exe
##
##  printenv -- demo CGI program which just prints its environment
##

print "Content-type: text/plain; charset=iso-8859-1\n\n";
foreach $var (sort(keys(%ENV))) {
    $val = $ENV{$var};
    $val =~ s|\n|\\n|g;
    $val =~ s|"|\\"|g;
    print "${var}=\"${val}\"\n";
}

-------------------------
现在问题是可以打开http://192.168.1.3/test.htm这个网,就是打不开这个网调用的CGI perl程序

这个服务apache2.2开始
单独编译运行perl程序,也是对的,就是做CGI不对?

请大家指教一下???
在windows下应该是#!d:\Perl\bin\perl.exe
在unix下#!/usr/bin/perl
跟这有什么关系,我都试了?

这个环境我还是没有调好?高手帮忙!!!!
我的在C:\Apache2.2\conf\httpd.conf也配置好了

[Sat Nov 11 20:52:26 2006] [error] [client 192.168.1.3] File does not exist: C:/Apache2.2/htdocs/favicon.ico

[ 本帖最后由 19857029 于 2006-11-11 21:05 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2006-11-10 22:50 |只看该作者

回复 1楼 19857029 的帖子

Hi,
configure your Apache's httpd.conf under C:\Apache2.2\conf
# Add more cgi's suffix
AddHandler cgi-script .cgi .pl .plx
# checking cgi-bin setting:
<IfModule alias_module>
    #
    # Redirect: Allows you to tell clients about documents that used to
    # exist in your server's namespace, but do not anymore. The client
    # will make a new request for the document at its new location.
    # Example:
    # Redirect permanent /foo http:///bar

    #
    # Alias: Maps web paths into filesystem paths and is used to
    # access content that does not live under the DocumentRoot.
    # Example:
    # Alias /webpath /full/filesystem/path
    #
    # If you include a trailing / on /webpath then the server will
    # require it to be present in the URL.  You will also likely
    # need to provide a <Directory> section to allow access to
    # the filesystem path.

    #
    # ScriptAlias: This controls which directories contain server scripts.
    # ScriptAliases are essentially the same as Aliases, except that
    # documents in the target directory are treated as applications and
    # run by the server when requested rather than as documents sent to the
    # client.  The same rules about trailing "/" apply to ScriptAlias
    # directives as to Alias.
    #
    ScriptAlias /cgi-bin/ "C:/Apache2/cgi-bin/"

</IfModule>

#
# "C:/Apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "C:/Apache2/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

--------

or just rename your env.pl to env.cgi if you want use default httpd.conf

regards, ulmer

论坛徽章:
0
3 [报告]
发表于 2006-11-11 18:43 |只看该作者
谢谢指教

到底是什么问题?
可档可以帮忙指出来的呢?
我看的一些东东好像懂又好像不懂
因为我是初学者

论坛徽章:
0
4 [报告]
发表于 2006-11-11 20:45 |只看该作者

不行呀,救救我

我忘了说我的httpd.conf已经上修改好的,就是楼上所说的那样,要检查了,都是对的,和你上面写的是一样的,怎么还是不行???

[Sat Nov 11 20:52:26 2006] [error] [client 192.168.1.3] File does not exist: C:/Apache2.2/htdocs/favicon.ico

高手指导一下!!!!!!

[ 本帖最后由 19857029 于 2006-11-11 21:03 编辑 ]

论坛徽章:
0
5 [报告]
发表于 2006-11-12 08:40 |只看该作者
上面这个错误不要紧

论坛徽章:
1
荣誉会员
日期:2011-11-23 16:44:17
6 [报告]
发表于 2006-11-13 08:11 |只看该作者
楼主找一下apache 的log...
看看error_log里面有什麽错误回传....
找一下..应该有才对...如果连看都看不到..
试着直接在dos模式下执行你的xxx.pl
看看有没有错误发生......

论坛徽章:
0
7 [报告]
发表于 2006-11-18 15:40 |只看该作者

问题已经解决了

谢谢大家的指导
问题已经解决了,
是这个语句有问题,<form method="get" acton="http://192.168.1.3/cgi-bin/env.pl">
谢谢,我改了,就ok了
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP