如何将PHP连接到Oracle?

时间:2012-03-12 16:41:34

标签: php oracle

我可以连接PHP和oracle吗?你能帮一些与之相关的书吗?

它们与我们使用MSSQL和MySQL的方式类似吗?例如:

Oracle_connect($dbhost,$dbport,$dbuser,$dbpass);

1 个答案:

答案 0 :(得分:-1)

首先,您需要使用OCI8 1.4扩展安装PHP 5.3.3。在php.ini中设置:

oci8.connection_class = MYPHPAPP

and then out this code:-

<?php
// Create connection to Oracle
$conn = oci_connect("phphol", "welcome", "//localhost/orcl");
if (!$conn) {
   $m = oci_error();
   echo $m['message'], "\n";
   exit;
}
else {
   print "Connected to Oracle!";
}
// Close the Oracle connection
oci_close($conn);
?>

或只是查看本教程

http://st-curriculum.oracle.com/obe/db/11g/r2/prod/appdev/opensrclang/phphol2010_db/php_db.htm