0

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
hakre
  • 193,403
  • 52
  • 435
  • 836
Basil Basaif
  • 362
  • 8
  • 20

2 Answers2

0

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
Basil Basaif
  • 362
  • 8
  • 20
0

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

Hardik Patel
  • 706
  • 5
  • 14
  • I actually tried that, but the problem i guess it's in the oci8 it self. It doesn't even show when i phpinfo();. I think the problem was from the php version it self. Thank you for your answer :) – Basil Basaif Jun 21 '13 at 17:00
  • Please tell me that which operating system you used? If window then which version? you can also try php version 5.3.X it will definitely work. – Hardik Patel Jun 22 '13 at 04:29
  • I'm using windows 7 home premium. I'll try that. – Basil Basaif Jun 22 '13 at 17:11