Mukund
Mukund

Reputation: 1105

Cannot connect to Oracle database from php

This is the code I got from a tutorial,

<?php

$db = “(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST =192.168.1.34)(PORT = 1521)))(CONNECT_DATA=(SID=orcl)))” ; //gave my corresponding ip

if ($c=OCILogon(“system”, “your database password“, $db))  // gave my corresponding username and password
 {

echo “Successfully connected to Oracle.\n”;

OCILogoff($c);

} else {

$err = OCIError();

echo “Connection failed.” . $err[text];

}


?>

I checked on the terminal for ping to this corresponding database, there is ping to this IP(my corresponding IP)

Also I can connect to this database via toad from a windows machine, I am currently using ubuntu

No message is displaying not even echo “Connection failed.” . $err[text];

What am I doing wrong please help

Upvotes: 0

Views: 161

Answers (1)

Robin
Robin

Reputation: 67

It seems you dont have php-oracle driver installed in your system, have you checked it? if its not there, download the appropriate one from oracle

http://kogentadono.com/2011/11/02/installing-oci8-on-ubuntu/

See if this helps

Upvotes: 1

Related Questions