我可以在共享主机上使用 Perl 的 Apache2::ASP CPAN 模块吗?
我正在尝试使用 CPAN 中的 Perl 模块 (AuthCookieDBI.pm 具体来说)在共享托管环境中。
我尝试将 .pm
文件复制到我尝试使用它的目录,并且我已按照 上的说明更新了我的
页面,但我的 Apache 日志显示:.htaccess
文件AuthCookieDBI
Invalid command 'PerlModule', perhaps misspelled or defined by a module not
included in the server configuration
这似乎是导致错误的行:
PerlModule Apache2::AuthCookieDBI
根据 Apache:ASP FAQ 这是因为没有安装 mod_perl
造成的; 我使用共享主机(因此无法执行任何需要 root 权限的操作),那么我对此无能为力吗?
I'm trying to use a Perl module from CPAN (AuthCookieDBI.pm to be specific) in a shared hosting environment.
I tried copying the .pm
file to the directory I'm trying to use it with, and I have updated my .htaccess
file as per the instructions on the AuthCookieDBI
page, but my Apache log says:
Invalid command 'PerlModule', perhaps misspelled or defined by a module not
included in the server configuration
This seems to be the line that causes the error:
PerlModule Apache2::AuthCookieDBI
According to the Apache:ASP FAQ this is caused because mod_perl
is not installed; I'm on shared hosting (and so cannot do anything which requires root permissions), so is there nothing I can do about this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
通常,您使用
cpan
工具来下载并安装该模块。它应该安装到标准位置,例如/usr/local/lib
下(请参阅perl -V
以查看@INC
的位置)目录设置为)。正确安装后,您的 perl 脚本将能够找到该模块,就像它是 perl 的标准部分一样,无需在 mod_perl 或 apache 配置中进行特殊修改。 (您还可以将模块安装到您的主目录,而不需要 root 权限。相关说明包含在 CPAN 常见问题解答中。)请参阅:
此外,CPAN 常见问题解答本身也包含大量信息。
编辑:毕竟,你的问题的真正答案似乎是“你不能;你需要找到一个不同的模块来完成你需要的事情,这不需要 mod_perl”。
Normally you use the
cpan
tool to download and install the module for you. It should be installed into a standard location, such as under/usr/local/lib
(seeperl -V
to see where your@INC
directory is set up to be). When it is properly installed, your perl scripts will be able to find the module just as if it was a standard part of perl, with no special modifications necessary in mod_perl or apache configs. (You can also install modules to your home directory without requiring root permission. Instructions for that are contained in the CPAN FAQ.)See:
Also, the CPAN FAQ itself has lots of information.
Edit: after everything, it would appear that the true answer to your question is "You can't; you need to find a different module to do what you need, that doesn't require mod_perl".
只需将解压后的模块放入
/path/lib/
即可,下面是包含此模块所需的代码。Just put the unpacked the module to
/path/lib/
, below is the code you need in order to include this module.如果您使用共享主机,则很可能不使用 mod_perl。因此你不能使用这个模块。简而言之,mod_perl 是程序员与 apache 交互的一种方式,可能会改变事情发生的方式。由于您正在共享 apache,因此让其他人接受您的更改并不好。
如果您想更好地控制您的服务器,您需要获得专用的网络服务器。您如何做到这一点取决于您的提供商提供的服务。
If you are on shared hosting, you are mostly likely not using mod_perl. Thus you can't use this module. In short, mod_perl is a way for programmers to interact with apache, potentially changing how things happen. Since you are sharing apache, it's not nice to make other people live with your changes.
If you want more control over your server, you need to get a dedicated web server. How you do that depends on what your provider offers.
Apache2::AuthCookieDBI 需要 mod_perl,因此如果没有它,该模块对您没有任何用处。
Apache2::AuthCookieDBI requires mod_perl, so the module isn't any use to you without it.