php: loading oracle driver gives error “Unable to

2019-02-18 05:33发布

I seem to have a strange problem with 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.

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.

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.

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

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.

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)

The software versions I'm using:

  • OS: Windows 2012 R2 x64
  • PHP: 5.6.3
  • Oracle database: 11.2.0.4.0

Any ideas?

标签: php oracle dll pdo
2条回答
够拽才男人
2楼-- · 2019-02-18 06:00

XAMPP comes with PHP compilled with ThreadSafe, so you have to download the file from this directory:

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楼-- · 2019-02-18 06:23

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.

查看更多
登录 后发表回答