just setup correctely your tnsnames.ora for your SID :
someting like :
YOUR_SID =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(COMMUNITY = YOUR.world)
(PROTOCOL = TCP)
(Host = IP_ADDRESS)
(Port = 1521)
)
)
(CONNECT_DATA =
(YOUR_SID = O734D1)
)
)
make sure your listener is up and running and listens for this database. ( check listener.ora and do a lsnrctl status)
Test your oracle connection outside php ( with sql*plus for example ).
Compile php with oracle enabled ( --with-oracle or --with-oci8 ) ( that is the tricky bit )
add your php module to apache.
stop/start apache
try to connect to oracle with php :
for ex :
<?
$conn = ora_logon('USER@YOUR_SID', 'PASSWORD );
$curs = ora_open( $conn );
ora_parse( $curs, "SELECT count(*) FROM USER_OBJECTS" );
ora_exec( $curs );
ora_fetch( $curs );
$result = ora_getcolumn($curs, 0 );
ora_close( $curs );
echo "RESULT :" . $result;
?>
BAsically, oracle does not have to be on the same machine as apache/oracle. The only thing is that you have to set up correctely your env. If u can use your remote database outside php, u will be able to use it inside.