免费注册 查看新帖 |

Chinaunix

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

[Web] 求助,有的cgi程序运行不了,有的可以。 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2004-11-15 19:39 |只看该作者 |倒序浏览
像这种可以:#!/usr/bin/perl
print "Content-type: text/html\n\n";
foreach $key (keys %ENV) {
print "$key -->; $ENV{$key}<br>;";
}
从网上下的源程序一般都不能用。显示:Premature end of script headers,在shell下执行出现: bad interpreter.没有这个文件或目录。
但是第一行就是#!/usr/bin/perl,路径并没有错啊。

论坛徽章:
62
2016科比退役纪念章
日期:2016-06-28 17:45:06奥兰多魔术
日期:2015-05-04 22:47:40菠菜神灯
日期:2015-05-04 22:35:07菠菜神灯
日期:2015-05-04 22:35:02NBA季后赛大富翁
日期:2015-05-04 22:33:34NBA常规赛纪念章
日期:2015-05-04 22:32:032015年亚洲杯纪念徽章
日期:2015-04-14 16:54:452015年亚洲杯之朝鲜
日期:2015-03-19 23:03:16明尼苏达森林狼
日期:2015-03-16 21:51:152015小元宵徽章
日期:2015-03-06 15:57:202015年迎新春徽章
日期:2015-03-04 09:55:282015年辞旧岁徽章
日期:2015-03-03 16:54:15
2 [报告]
发表于 2004-11-16 13:56 |只看该作者

求助,有的cgi程序运行不了,有的可以。

原帖由 "ar996" 发表:
像这种可以:#!/usr/bin/perl
print "Content-type: text/html\n\n";
foreach $key (keys %ENV) {
print "$key -->; $ENV{$key}<br>;";
}
从网上下的源程序一般都不能用。显示:Premature end of script..........



Premature end of script headers

就是你写错了

论坛徽章:
1
技术图书徽章
日期:2013-12-05 23:25:45
3 [报告]
发表于 2004-11-16 15:40 |只看该作者

求助,有的cgi程序运行不了,有的可以。

cgi程序一般不要再shell下执行。

web环境和shell环境有区别的

论坛徽章:
0
4 [报告]
发表于 2004-11-16 17:39 |只看该作者

求助,有的cgi程序运行不了,有的可以。

我也遇到同样的问题,想求助cgi的perl解释路径在那个文件修改啊,我的perl装在c/usr下 ,谢谢了

论坛徽章:
0
5 [报告]
发表于 2004-11-16 19:34 |只看该作者

求助,有的cgi程序运行不了,有的可以。

我看到apache手册上是这么说的,
Most of the time when a CGI program fails, it's because of a problem with the program itself. This is particularly true once you get the hang of this CGI stuff, and no longer make the above two mistakes. The first thing to do is to make sure that your program runs from the command line before testing it via the web server. For example, try:

cd /usr/local/apache2/cgi-bin
./first.pl

(Do not call the perl interpreter. The shell and Apache should find the interpreter using the path information on the first line of the script.)

在shell下能执行的,的确可以正常的浏览。

论坛徽章:
0
6 [报告]
发表于 2004-11-21 14:17 |只看该作者

求助,有的cgi程序运行不了,有的可以。

期待有人解决,我也碰到这样的问题了

论坛徽章:
1
技术图书徽章
日期:2013-12-05 23:25:45
7 [报告]
发表于 2004-11-22 20:26 |只看该作者

求助,有的cgi程序运行不了,有的可以。

究竟是什么操作系统?
不同的操作系统设置也不完全一样的,还可以设置
Option ExecCGI

论坛徽章:
0
8 [报告]
发表于 2004-11-23 20:46 |只看该作者

求助,有的cgi程序运行不了,有的可以。

dos2unix 转换一下,看看能不能好。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP