How to use oracle 11.2 client with php (xampp) on win7 x64

I just installed acutal XAMPP on my win7 (x64) machine in order to write some PHP scripts to connect to Oracle. I also have the regular Oracle 11.2.0 client installed (PATH and ORACLE_HOME set correctly). The client is used for all my other work without any problem.

When I try to connect to oracle, PHP PHP fails with Fatal error: Call to undefined function oci_connect() in

. I remember that I had to enable "oci8-extensions" in my php.ini when I did the same a few years ago on a x32 winXP PC. But my current xampp doesn't have these dlls in the folder php/ext

(only php_oci8_12c.dll

which throws a few unknown function errors when starting apache, and for oracle 12, not 11) and php.ini also says they are for instant client only.

;extension=php_oci8.dll      ; Use with Oracle 10gR2 Instant Client
;extension=php_oci8_11g.dll  ; Use with Oracle 11gR2 Instant Client

      

Also this SO question shows that using a comment extension with a normal client won't work (which I tried as well).

I tried google for a solution, but all the "solutions" are "install win32 instant client and enable extension". But I can't do that as most of my QA work requires 11.2.0 client installed and configured and I don't have a .dll in my php / ext folder at all

I also tried copying the ociw32.dll file from the client / bin folder to the php / ext folder, but then apache says it is not a PHP library.

So how can I let PHP oracle libraries use oci8 for XAMPP on x64 win7 WITHOUT installing win32 Oracle Instant Client and destroying my current settings?

edit: I've also tried the steps described in PHP: Installation Guide (post: samantha dot vincent at gmail dot com) , including changing my apache-http.conf which also didn't help.

I am also confused about my phpinfo()

-Output as they say

Configure Command   "--with-pdo-oci=c:\php-sdk\oracle\x86\instantclient_12_1\sdk,shared" "--with-oci8-12c=c:\php-sdk\oracle\x86\instantclient_12_1\sdk,shared"

      

+3


source to share


1 answer


Finally I found a solution:

I downloaded the actual OCI DLL from "PECL :: PAckage :: oci8 :: 2.0.8" (in my case 32bit, threadafe DLL) and then removed ;

from this line

;extension=php_oci8_11g.dll  ; Use with Oracle 11gR2 Instant Client

      



I also added the following lines to http.conf for apache

SetEnv ORACLE_BASE "C:/oracle/"
SetEnv ORACLE_HOME "C:/oracle/product/11.2.0/client_1"  

      

After that, I restarted apache, made sure my connection alias was probably placed in mine tsnames.ora

, and then I could use the oci8 functions without any problem.

+5


source







All Articles