Question

I'm trying to access the ORACLE database from PHP, i'm using WampServer Version 2.2 Apache 2.4.2 – PHP 5.4.3 and oracle 11g. I tried many ways including :

<?php

if ($conn = oci_connect('sys as sysdba', '12345', '//localhost/orcl'))
{
    print 'Successfully connected to Oracle Database!';     
}
else
{
     $errmsg = oci_error();
     print 'Oracle connection failed' . $errmsg['message'];
}
?>

i get the following error every time i execute:

Fatal error: Call to undefined function OCILogon() in C:\wamp\www\IDS\Index.php on line 3

Does anyone know how to solve this ??

Was it helpful?

Solution

I had to remove the ";" semicolon from the php.ini file at the oci8 line

it was like this:

;extension=php_oci8.dll

i changed it to:

extension=php_oci8.dll

OTHER TIPS

The correct connect string would look like
$conn = oci_connect('sys', '12345', '//localhost/orcl', null, OCI_SYSDBA))

Make sure you have
oci8.privileged_connect = on in your php.ini in order to enable privileged connections. Look out for this parameter in the [OCI8] section of your php.ini.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top