为什么我的 Perl CGI 脚本找不到 Oracle DBD?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/294465/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 17:28:40  来源:igfitidea点击:

Why can't my Perl CGI script find the Oracle DBD?

sqlperloraclepermissions

提问by

DBD, and Oracle Masters:

DBD 和 Oracle 大师:

I have a Perl web application that is behaving oddly. I am using it to read some stuff from an Oracle DB and report. I have version 11.1.0.6.0 of Oracle's Instant Client installed. I'm running on WinXP and have the PATH environment variable set to the instant client location. I have Apache2 for my webserver.

我有一个行为奇怪的 Perl Web 应用程序。我正在使用它从 Oracle DB 中读取一些内容并报告。我安装了 Oracle Instant Client 11.1.0.6.0 版。我在 WinXP 上运行,并将 PATH 环境变量设置为即时客户端位置。我的网络服务器有 Apache2。

Here's the issue: when I run the app from a command line, it works without a hitch. However, when I run from http://127.0.0.1/cgi-bin/a.cgi, I get the following DB access error:

问题是:当我从命令行运行应用程序时,它可以顺利运行。但是,当我从http://127.0.0.1/cgi-bin/a.cgi运行时,出现以下数据库访问错误:

install_driver(Oracle) failed: Can't load 'C:/usr/lib/auto/DBD/Oracle/Oracle.dll' for module DBD::Oracle: load_file:The specified module could not be found at C:/usr/lib/DynaLoader.pm line 202. at (eval 9) line 3

install_driver(Oracle) failed: Can't load 'C:/usr/lib/auto/DBD/Oracle/Oracle.dll' for module DBD::Oracle: load_file:The specified module could not be found at C:/usr/lib/DynaLoader.pm line 202. at (eval 9) line 3

Intuition tells me it's a permission issue, but I'm not sure where to look further. Can anyone shed some light on this? I would much appreciate any help.

直觉告诉我这是一个许可问题,但我不确定在哪里可以进一步查看。任何人都可以对此有所了解吗?我将不胜感激任何帮助。

Thanks, Saker Ghani

谢谢,萨克·加尼

回答by Alnitak

The fact that the error shows the full path of the .DLL suggests that the system isn't having any trouble finding the DLL, so that does back your theory that file permissions are the issue.

错误显示 .DLL 的完整路径这一事实表明系统在查找 DLL 时没有遇到任何问题,因此这确实支持了您的理论,即文件权限是问题所在。

To test whether it really is a permissions issue, try writing a trivial Perl CGI script which does nothing but directly open that specific .DLL file (with a normal opencall) and reports whether it worked or not.

要测试这是否真的是权限问题,请尝试编写一个简单的 Perl CGI 脚本,该脚本除了直接打开特定的 .DLL 文件(使用正常open调用)并报告它是否有效之外什么都不做。

回答by Alnitak

Thanks Alnitak. I tried doing what you suggested, and 'open' successfully opened 'C:/usr/lib/auto/DBD/Oracle/Oracle.dll'. I remember seeing this exact bug when I was developing on a different machine, but that was because the Oracle Instant Client libs were mising on it. After I installed those, and set the 'Path' variable, everything started working fine.

谢谢阿尔尼塔克。我尝试按照您的建议进行操作,并且“打开”成功打开了“C:/usr/lib/auto/DBD/Oracle/Oracle.dll”。我记得我在另一台机器上开发时看到过这个确切的错误,但那是因为 Oracle Instant Client 库在它上面丢失了。在我安装这些并设置“路径”变量后,一切都开始正常工作。

回答by Ronnie

I have had the same issue, where on accessing the cgi perl program through Interface was reporting the error "Install_driver(Oracle) failed: Can't load 'C:/Perl/lib/auto/DBD/Oracle/Oracle.dll' for module DBD::Oracle: load_file:Access is denied at C:/Perl/lib/DynaLoader.pm line 201".

我遇到了同样的问题,在通过 Interface 访问 cgi perl 程序时报告错误“Install_driver(Oracle) failed: Can't load 'C:/Perl/lib/auto/DBD/Oracle/Oracle.dll' for模块 DBD::Oracle: load_file:Access is denied at C:/Perl/lib/DynaLoader.pm line 201"。

I was using Perl 5.10 on Window 2003 Server with IIS 6.

我在带有 IIS 6 的 Window 2003 Server 上使用 Perl 5.10。

The resolution was to give the permissions on Perl directory to "Everyone" as well as on the Oracle Install folder.

解决方案是将 Perl 目录的权限授予“Everyone”以及 Oracle Install 文件夹。