Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Warning at startup while trying to load php_oci8.dll

I'm using XAMPP and trying to configure Oracle connection for sql.

I uncommented the line extension=php_oci8.dll and at first it ended up with an error (that oci.dll is missing), but later I downloaded instantclient from Oracle web pages. I tried with versions 10.2, 11.2, and 12.1 but neither worked. Obviously I've added the path to those libraries to my PATH env variable.

The warning I'm getting at the startup of Apache is: PHP Warning: PHP Startup: in Unknown on line 0

The error when I'm trying to connect is: PHP Fatal error: Call to undefined function oci_connect() in ...

I've tried with php_oci8.dll and php_oci8_11g.dll. Those files are in my php/ext directory (they were included in xampp), my instantclient is added to PATH and the warning doesn't show up if I disable those modules. I've tried restarting services and computer.

Can you help me find a solution how to configure it correctly? I'm using Windows 8.1 with administrative privileges.

BTW. My phpinfo() says that OCI8 is activated (but functions like oci_connect still don't work).

EDIT: When I tried running PHP manually I finally got the error to display what was wrong: Unable to load dynamic library 'C:\Program Files (x86)\PHP\ext\php_oci8_11g.dll' - %1 is not a valid Win32 application. in Unknown on line 0 Can you help me find out where can I download a correct version?

like image 469
Kelu Thatsall Avatar asked Dec 29 '13 13:12

Kelu Thatsall


2 Answers

There was a problem with 64bit version of instantclient. If you ever have the same issue, please install 32bit version of instantclient.

To be honest the easiest way is just to follow PROPER instructions: http://www.oracle.com/technetwork/articles/dsl/technote-php-instant-084410.html

I tried a lot of other advices and they all went really bad on me (not just because I used different bit version - also I copied the files everywhere following stupid advices and it was hard to correct it)

like image 200
Kelu Thatsall Avatar answered Oct 13 '22 13:10

Kelu Thatsall


Its because your Oracle is 64 bit. Remove it and install a 32 bit version of Oracle client and it will work.

like image 39
Umesh Patil Avatar answered Oct 13 '22 13:10

Umesh Patil