It is very easy for PHP to connect to oracle8 under Linux/Unix, but it is really not easy under the windows platform. I have found a reliable method after a long period of exploration, and I dare not keep it to myself.
I will publish it now for everyone.
The development environment used by the author:
Windows 98 second edition
php4.04pl1
apache 1.3.14 window version
oracle 8.05 client
PHP was installed in CGI mode and tested successfully back. Test with the following code
$conn = OCILogon("cinmsiii","cinmsiii","(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.3.202)(PORT = 1521) )(CONNECT_DATA = (SID = unicom)))");
//$conn=OCILogon("cinmsiii","cinmsiii","cinms"); If the oracle client is 8.1.6i, you can use it like this, Parameters are shown below
if($conn!=false)
{
echo "ok";
OCILogoff($conn);
}
else
echo "false" ;
?>
About the connection parameters:
The connection string is set to the following:
(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.3.202)(PORT = 1521)) (CONNECT_DATA = (SID = unicom)))
PROTOCOL: is the network protocol used
HOST: is the database server host name
SID: is the instance number of the database
Generally there will be no problems after doing this .