Home  >  Article  >  Backend Development  >  Connection settings between PHP4.0 and Oracle 8 under Windows_PHP tutorial

Connection settings between PHP4.0 and Oracle 8 under Windows_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:22:571334browse

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 .


If your oracle 8 client is 8.1.6i enterprise version, you can set these parameters in the connection string and use oracle8's net easy config utility to set them.
Pass the set connection string name as the connection string.
It is speculated that Oracle 7.x can also use this method. Since there is no environment, it has not been tested. If you are interested, you can try it.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/532267.htmlTechArticleIt is very easy for PHP to connect to oracle8 under Linux/Unix, but it is really not easy under the windows platform. I have experienced it It took a long time of exploration to find a reliable method. I don’t dare to keep it to myself, but I am publishing it now for everyone’s enjoyment. ...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn