获取 $ENV{'QUERY_STRING'} 时出现奇怪的问题

发布于 2024-10-06 22:21:03 字数 971 浏览 0 评论 0原文

我这里有一个奇怪的问题。我正在将一个(工作)站点移动到一个新的 apache 服务器,我无法直接访问该服务器(我必须通过两个人才能完成工作)。

该网站使用名为 adframe 的 Perl 脚本来解析 html 模板。调用它的 URL 类似于 /cgi-bin/adframe/index.html?x=something,其中 adframe 是脚本。丢失的后缀从未造成任何真正的问题。但在这个新的 Ubuntu 服务器上 $ENV{'QUERY_STRING'} 始终为空。 $ENV{'REQUEST_METHOD'} 正确显示为 GET,但 query_string 没有显示任何内容...

常规 *.cgi 脚本显示 query_string 没有问题。

从我收集的日志来看,服务器似乎正在运行 fastcgi、mod_fcgid,并且服务器甚至不接受 .pl 作为脚本的扩展名。我对服务器软件没有太多经验,但我认为这可能是服务器不接受 adframe 作为 cgi 脚本的问题,因此没有正确传递 query_string ...任何人都可以给我一些提示,告诉我我在哪里可以指出管理员或者我自己可以在 .htaccess 中做些什么吗?不管怎样,要确保 adframe 被识别为 cgi 脚本!? (如果这是问题......)

任何帮助表示感谢! 托马斯

编辑:我发现了更多详细信息:服务器似乎正在运行 VARNISH 缓存...这是与我通常的配置的主要区别... 另外,脚本的工作方式是,如果您调用 /cgi-bin/adframe/somedir/somefile.html?x=something,$ENV{PATH_INFO} 会告诉要解析哪个模板,而 $ENV{QUERY_STRING} 是,嗯,查询字符串。现在查询字符串是空的,但是如果我调用 /cgi-bin/adframe?x=something (没有任何 PATH_INFO),查询字符串就会显示! 有人知道这里发生了什么事吗? 谢谢!

I'm having a strange problem here. I'm moving a (working) site to a new apache server to which I don't have direct access (I have to go through two people to get stuff done).

The site uses a perl script called adframe to parse html templates. The URLs with which it's called look like /cgi-bin/adframe/index.html?x=something with adframe being the script. The missing suffix never caused any real problems. But on this new Ubuntu server $ENV{'QUERY_STRING'} is always empty. $ENV{'REQUEST_METHOD'} shows up correctly as GET, but the query_string shows nothing ...

Regular *.cgi scripts show the query_string without problems.

From the logs I gathered that the server seems to be running fastcgi, mod_fcgid and the server doesn't even accept .pl as an extension for scripts. I don't have that much experience with server software, but I figured it might be a problem with the server not accepting adframe as a cgi script and thus not passing the query_string correctly ... Can anyone give me a few hints to where I could point the administrator or maybe something I could do in .htaccess myself? Anyway to make sure, adframe is recognized as a cgi script!? (if that's the problem ...)

Any help is appreciated!
thomas

EDIT: I found more details: The server seems to be running a VARNISH cache ... thats's the main difference to my usual configurations ...
Also, the way the script works is, if you call /cgi-bin/adframe/somedir/somefile.html?x=something, $ENV{PATH_INFO} tells which template to parse and $ENV{QUERY_STRING} is, well, the query string. Now the query string is empty, but if I call /cgi-bin/adframe?x=something (without any PATH_INFO), the query string shows up!
Does anyone have an idea what's going on here?
thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

∞梦里开花 2024-10-13 22:21:03

知道了。 VARNISH 缓存将所有查询字符串从静态内容(*.html 等)中剥离...唷

Got it. The VARNISH cache strips all the query strings off static content (*.html etc) ... phew

伪装你 2024-10-13 22:21:03

刚刚遇到了同样的问题。我是 Perl 脚本编写的新手。

我尝试了以下方法:

@values = split (/&/, $ENV{'QUERY_STRING'});

但它不起作用,

这有效:

@values = split (/&/, "$ENV{'QUERY_STRING'}");

以防万一其他新手遇到同样的问题。

Just ran into the same problem. I am complete newbie in perl scripting.

I tried following:

@values = split (/&/, $ENV{'QUERY_STRING'});

but it didn`t work

this worked:

@values = split (/&/, "$ENV{'QUERY_STRING'}");

just in case if other newbies have ran into the same problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文