php: 加载 oracle 驱动程序出现错误“无法加载动态库 - 找不到指定的程序。”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30780271/
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-19 02:54:10  来源:igfitidea点击:

php: loading oracle driver gives error "Unable to load dynamic library - The specified procedure could not be found."

phporacledllpdo

提问by ErikL

I seem to have a strange problem with PHP.

我似乎对 PHP 有一个奇怪的问题。

I've migrated a bunch of software from one server to another. On the server some scripts make a connection to Oracle, so to be able to make a connection the oracle client is installed and a tnsnames file is in place. Connection from sql*plus works.

我已经将一堆软件从一台服务器迁移到另一台服务器。在服务器上,一些脚本与 Oracle 建立连接,因此为了能够建立连接,安装了 oracle 客户端并且 tnsnames 文件就位。来自 sql*plus 的连接有效。

Some of the scripts use PDO, so for that I've enabled extension=php_pdo_oci.dll in php.ini. These scripts work like a charm.

一些脚本使用 PDO,因此我在 php.ini 中启用了 extension=php_pdo_oci.dll。这些脚本就像一个魅力。

Some other scripts use functions like oci_connect, and these need a extension like php_oci8.dll. With xammp (that I use as apache/php/mysql bundle) php_oci8_12c.dll is delivered, so I thought that extension would be adequate.

其他一些脚本使用像 oci_connect 这样的函数,而这些需要像 php_oci8.dll 这样的扩展。使用 xammp(我用作 apache/php/mysql 包)提供了 php_oci8_12c.dll,所以我认为这个扩展就足够了。

When starting the server, I see these errors in the php errorlog:

启动服务器时,我在 php 错误日志中看到这些错误:

Unable to load dynamic library 'C:\xampp\php\ext\php_oci8_12c.dll' - The specified procedure could not be found.

The file is in located in C:\xampp\php\ext\, so that shouldn't be a problem. Other extensions that are in the same dir are picked up without any problems. I've also tried to load php_oci8.dll, wich I picked up from the old server, but got exactly the same problem.

该文件位于 C:\xampp\php\ext\,所以这应该不是问题。同一目录中的其他扩展名可以毫无问题地被选中。我还尝试加载 php_oci8.dll,这是我从旧服务器上获取的,但遇到了完全相同的问题。

Some answers I found to similar problems I tried without success: - copying the dll to c:\windows\system - adding the php ext dir to the system PATH variable - adding the oracle client to the system PATH variable (was already in there)

我找到了一些我尝试过但没有成功的类似问题的答案: - 将 dll 复制到 c:\windows\system - 将 php ext dir 添加到系统 PATH 变量 - 将 oracle 客户端添加到系统 PATH 变量(已经在那里)

The software versions I'm using:

我使用的软件版本:

  • OS: Windows 2012 R2 x64
  • PHP: 5.6.3
  • Oracle database: 11.2.0.4.0
  • 操作系统:Windows 2012 R2 x64
  • PHP:5.6.3
  • Oracle 数据库:11.2.0.4.0

Any ideas?

有任何想法吗?

回答by ErikL

Seems like I figured it out and can answer my own question. It looks like XAMPP is delivering a non-suitable ddl with their distribution. The right and most recent oci8 dll's are downloadable here in all possible flavors: http://windows.php.net/downloads/pecl/releases/oci8/2.0.8/. Once I got the right one, it worked like a charm.

似乎我想通了,可以回答我自己的问题。看起来 XAMPP 正在为其发行版提供不合适的 ddl。正确的和最新的 oci8 dll 可以在这里下载所有可能的版本:http: //windows.php.net/downloads/pecl/releases/oci8/2.0.8/。一旦我选对了,它就像一种魅力。

回答by Welisson Carlos Dias

XAMPPcomes with PHPcompilled with ThreadSafe, so you have to download the file from this directory:

XAMPP附带了用ThreadSafe编译的 PHP,所以你必须从这个目录下载文件:

http://windows.php.net/downloads/pecl/releases/oci8/2.0.8/

http://windows.php.net/downloads/pecl/releases/oci8/2.0.8/...

Before you paste the 3 DLLs to C:\xampp\php\ext*, append ".old*" to each file. Be sure you have enabled the good DLL according to your version of your Oracle database in the file php.ini. Finally, Restart Apache.

在将 3 个 DLL 粘贴到 C:\xampp\php\ext* 之前,将“.old*”附加到每个文件。确保根据您在php.ini文件中的 Oracle 数据库版本启用了良好的 DLL 。最后,重启Apache。