4

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?

ErikL
  • 2,031
  • 6
  • 34
  • 57

2 Answers2

7

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.

ErikL
  • 2,031
  • 6
  • 34
  • 57
  • 4
    True, XAMPP 3.2.2 (with php 5.6.21) comes with bad version of OCI8. I've followed your link and now it's working! Thank you. I've download php_oci8-2.0.8-5.6-ts-vc11-x86.zip – BigPino Jun 22 '16 at 19:39
  • @BigPino I have the same problem with xampp and oracle, when i start apache , i get this error ( The entry point of the OCISessionGet procedure is not found in the dynamic link library C:\xampp\php\ext\php_oci8_12c.dll ) then i checked the error log: Unable to load dynamic library 'C:\xampp\php\ext\php_oci8_12c.dll' - The specified procedure could not be found. Where did you put the oci8 dll ?? – Leoh Jun 15 '17 at 14:09
  • XAMPP comes with PHP compilled with ThreadSafe, so you have to download this file : http://windows.php.net/downloads/pecl/releases/oci8/2.0.8/php_oci8-2.0.8-5.6-ts-vc11-x86.zip Before paste the 3 dlls here : C:\xampp\php\ext\, rename to .old Be sure you have enable the good DLL according to your version of your Oracle database in the file php.ini. Finally, Restart Apache – BigPino Jun 15 '17 at 15:00
  • @Leoh, see my answer above. Forgot to link you! – BigPino Jun 15 '17 at 15:31
  • @BigPino same problem, i checked the logs and gets this: PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\xampp\\php\\ext\\php_oci8_11g.dll' The module can not be found m\xef\xbf\xbddulo – Leoh Jun 16 '17 at 15:08
  • @Leoh : Does Oracle Client 11g is installed (Full version, x86) on your server? Make sure you have 32 bits version instead of 64 bits! XAMMP for Windows is 32 bits ONLY. – BigPino Jun 16 '17 at 15:18
  • thanks @BigPino I already fix it uninstalling xampp and use apache & php & oracle 11g XE – Leoh Jun 19 '17 at 19:44
0

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.

Sᴀᴍ Onᴇᴌᴀ
  • 8,218
  • 8
  • 36
  • 58