This code connects to a database and executes a command
$oracledb["host"] = "MYSERVICE"; # service name in the tnsnames.ora file
$oracledb["user"] = "myuser"; # username
$oracledb["pass"] = "mypass"; # password
$oracledb["library"] = "OCI";
$connect_id = ocilogon($oracledb["user"], $oracledb["pass"], $oracledb["host"]);
$query = "SELECT * FROM table";
$statement = ociparse($connect_id, $query);
ociexecute($statement);
$result = array();
while(ocifetchinto($statement, $tmp, OCI_ASSOC + OCI_RETURN_NULLS + OCI_RETURN_LOBS))
{
array_push($result, $tmp);
}
ocifreestatement($statement);
var_dump($result); # result is here
From http://stackoverflow.com/questions/4583962/connect-to-an-oracle-database-using-php