Oracle 11.1.0.7 and WAMP oci_connect failure

后端 未结 2 781
我在风中等你
我在风中等你 2021-01-20 15:11

I\'m trying to configure a simple connection between my local WAMP server and some Oracle 11.1.0.7 I have. Apparently PHP has all sorts of solutions and magic situations whe

相关标签:
2条回答
  • 2021-01-20 15:55
    1. execute "phpinfo()";
    2. in "Configure Command", you will see something like: "--with-pdo-oci=C:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8=C:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8-11g=C:\php-sdk\oracle\instantclient11\sdk,shared" ... till now ok!
    3. download Oracle "Instant Client for Microsoft Windows 32-bit" and your "SDK" from http://www.oracle.com/technetwork/topics/winsoft-085727.html , even if your Windows is 64-bit: 3.1 download "Instant Client Package - Basic: All files required to run OCI, OCCI, and JDBC-OCI applications: instantclient-basic-win32-11.1.0.7.0.zip" 3.2 download "*Instant Client Package - SDK: Additional header files and an example makefile for developing Oracle applications with Instant Client: instantclient-sdk-win32-11.1.0.7.0.zip" 3.4 unpack two zip in same folder, you will see SDK into folder of instantclient_11 after unpacked; till here OK!
    4. copy this unpacked folder to C:\Windows\SysWOW64\instantclient_11_1
    5. create C:\php-sdk\oracle\instantclient11, and copy the content of C:\Windows\SysWOW64\instantclient_11_1 to C:\php-sdk\oracle\instantclient11
    6. Now, ADD to Windows Environment Variable PATH the follow: "C:\Windows\SysWOW64\instantclient_11_1"
    7. And finally, open Wamp and enable php_oci8_11g extension
    8. Check "phpinfo()" again; It works! Why??? Because C:\wamp\bin\php\php5.3.13\ext\php_oci8_11g.dll or C:\wamp\bin\php\php5.3.13\ext\php_oci8.dll are 32-bit DLLs; into 64-bit environment, when your Windows needs a 32-bit version of "Oracle Instant Client", it will seek into C:\Windows\SysWOW64 .
    0 讨论(0)
  • 2021-01-20 16:13

    Looking at your configuration, you have both the Oracle Client and the Oracle Instant Client installed:

    Oracle Run-time Client Library Version  10.2.0.1.0
    Oracle Instant Client Version   11.2
    

    However, my experience is that PHP will only use one or the other - basically, whichever set of libraries is found first will get used. Since you can connect fine to Oracle 10g, but not to 11g, that suggests that the 10g Client Library is "higher" in your path than the Instant Client libraries.

    Two options I'd suggest exploring:

    1. Install the full Oracle 11g Client
    2. Specifically alter your path to ensure that the Instant Client libraries are found first - making sure, of course, that you are impacting the effective path used by PHP, not just a PATH variable in a separate context...

    I've never actually got PHP to work correctly with the Instant Client - I gave up and installed the full client - so my personal recommendation is option 1, but if that's not practical in your environment, work with the PATH first.

    0 讨论(0)
提交回复
热议问题