The oracle client has to be installed on the PHP machine. Not the database itself. In order for PHP to connect to a remote oracle db, it needs some sort of session ID to connect with.
Here's how I make remote connections via php to an oracle DB:
$sql = "SELECT * FROM table WHERE field = 'field";
// create connection
$connection = OCILogon("user","pass","SID")
or die("Couldn't logon.");
// parse SQL statement
$sql_statement = OCIParse($connection,$sql)
or die("Couldn't parse statement.");
// execute SQL query
OCIExecute($sql_statement)
or die("Couldn't execute statement.");
while (ocifetch($sql_statement)) {
ociresult($sql_statement,"field");
}
On my solaris box, oracle is installed:
/u01/app/oracle/product/8.1.6/
The tnsnames.ora file which contains all of the IP's, ports and db's is read by the SID you call and the translations are made automatically. But AFAIK, you HAVE to have at least the oracle client on the same server as PHP.