【问题标题】:How can I create and maintain sessions in series of Perl CGI scripts?如何在一系列 Perl CGI 脚本中创建和维护会话?
【发布时间】:2010-01-04 08:18:28
【问题描述】:

我是 CGI-Perl 和会话的新手。我在运行以下代码时遇到问题。

我有四个文件 1. Session.html 或 Session.pm 2.名称.pl 3.爱好.pl 4. 工作.pl

Session.pm 放在 /var/www/html 文件夹中,其余文件放在 /var/www/cgi-bin/session 文件夹中。

我有一个基本的 html 文件(Session.html),它有一个指向 perl 脚本的链接,它给出了以下错误

[Mon Jan 04 14:21:24 2010] [error] [client ::1] Options ExecCGI is off in this directory: /var/www/html/name.pl, referer: http://localhost/Session.html
[Mon Jan 04 14:21:29 2010] [error] [client ::1] Options ExecCGI is off in this directory: /var/www/html/name.pl, referer: http://localhost/Session.html
[Mon Jan 04 14:22:42 2010] [error] [client ::1] (13)Permission denied: exec of '/var/www/cgi-bin/session/name.pl' failed, referer: http://localhost/Session.pm
[Mon Jan 04 14:22:42 2010] [error] [client ::1] Premature end of script headers: name.pl, referer: http://localhost/Session.pm

请帮助我执行上述示例。请从一开始就告诉我要遵循的步骤。

【问题讨论】:

  • 您可以检查错误日志文件(位于 Apache 存储错误日志的位置)并为您的请求发布错误日志条目,而不是从浏览器中显示 500 服务器错误。它通常会指出问题发生的位置。

标签: perl apache session cgi


【解决方案1】:

... Options ExecCGI 在这个目录下是关闭的:/var/www/html/name.pl, ...

这个错误指向试图在 /var/www/html/ 而不是 /var/www/cgi-bin/session/ 中运行 name.pl

您发布的 Session.html 是否正确,因为它似乎与此错误不符?

... (13)Permission denied: exec of '/var/www/cgi-bin/session/name.pl' failed, ...

name.pl 无法运行,因为它没有设置执行权限(在 Linux/Unix 上您需要 chmod a+x name.pl)。


您可能需要展示 Session.pm 的作用(看起来不像您在此处使用 CPAN 模块 Session)。

一般来说,我会考虑先将你所做的事情简化为一个简单的 HTML 和 CGI​​ 脚本,然后让它工作。然后开始研究会话等。

查看Ovid's CGI Tutorial,了解有关 Perl/CGI 主题的一些明智建议。

/I3az/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-11-29
    • 1970-01-01
    • 1970-01-01
    • 2012-03-10
    • 1970-01-01
    • 2015-04-03
    相关资源
    最近更新 更多