Oracle 11.1.0.7 and WAMP oci_connect failure

dotdot picture dotdot · Feb 1, 2012 · Viewed 6.9k times · Source

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 where it fails to start.

I'm running the latest 32bit version from WAMP (I fetched it today again just to check) The db machine is also 32bit, not local

here are my attempts in connecting to the database, everytime I got the same error :

    $db = "(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = some.ip.addr)(PORT = 1521)))(CONNECT_DATA=(SID=somesid)))";
    //$link = oci_connect('sqlmap', 'sqlmap', 'some.ip.addr') OR die('oci_connect' . print_r(oci_error()));
    //$link = oci_connect('sqlmap', 'sqlmap', $db) OR die('oci_connect error' . print_r(oci_error()));
    //$link = oci_connect('sqlmap','sqlmap', 'some.ip.addr/somesid') or die('<= oci_connect ' . print_r(oci_error()));
    //$link = oci_connect('sqlmap','sqlmap', '//some.ip.addr/somesid') or die('<= oci_connect ' . print_r(oci_error()));
    $link = oci_connect('sqlmap','sqlmap', '//some.ip.addr/somesid');

Warning: oci_connect() [function.oci-connect]: ORA-24315: illegal attribute type in


Array ( [code] => 24315 [message] => ORA-24315: illegal attribute type [offset] => 0 [sqltext] => ) oci_connect1

Some more information regarding OCI

OCI8 Support    enabled
Version 1.4.7
Revision    $Revision: 321634 $
Active Persistent Connections   0
Active Connections  0
Oracle Run-time Client Library Version  10.2.0.1.0
Oracle Instant Client Version   11.2
Temporary Lob support   enabled
Collections support enabled

Directive   Local Value Master Value
oci8.connection_class   no value    no value
oci8.default_prefetch   100 100
oci8.events Off Off
oci8.max_persistent -1  -1
oci8.old_oci_close_semantics    Off Off
oci8.persistent_timeout -1  -1
oci8.ping_interval  60  60
oci8.privileged_connect Off Off
oci8.statement_cache_size   20  20


Apache Version :
2.2.21  
PHP Version :
5.3.9

I would be fond if anyone could hint me what I might be missing

Answer

Rocketeer picture Rocketeer · Mar 6, 2012

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.