Question

I'm using wampserver and i want to use the oci8 to connect to the oracle database i enabled the oci8 but when ever i see my phpinfo(); it's not there can any one tell me what's going on. i have been searching everywhere for hours but i couldn't find a solution at all. i'm using WampServer Version 2.2 Apache 2.4.2 – PHP 5.4.3 and oracle 11g. every time i execute:

<?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'];
}
?>

it shows this error :

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

Solution

I downloaded a different php and Apache version instead of Apache 2.4.2 – PHP 5.4.3 now i'm using Apache 2.2.2 – PHP 5.2.6 from wampserver-Addons - Add versions of Apache, MySQL et PHP and i reemoved 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

First enable your wampserver extension php_oci8 and php_oci8_11g. then please try below code.

In this please put database name instead of SID.

$c = oci_connect($userName, $password, "(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST =$serverName)(PORT = 1521)))(CONNECT_DATA=(SID=$databaseName)))");

After using this connection string you can access all database function like
OCIParse OCIExecute

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