简体   繁体   中英

Can't Connect PHP - Oracle 11g

Just Trying to connect PHP to remoted Oracle 11g and still not good to go.

This is my phpinfo

PHPINFO

<?php
 $dbx = "(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)
(HOST = 192.168.1.131)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = TESDB)))";

$dbz = "//192.168.1.131:1521/TESDB";


$db = oci_connect("user1", "user123", $dbz);

if (!$db) die("Error connecting to Oracle database: " . oci_error());

echo "Successfully connected to Oracle database!";

?>

I have 2 variables $dbx and $dbz tried both of them, both are failed even oci_error doesn't give me a message error am I missing something?

Thanks

There is an error in the line:

$dbz = "//192.168.1.131:1521/TESDB"

The ; is missing, try this:

<?php
$dbz = "192.168.1.131:1521/TESDB";
$conn = oci_connect("user1", "user123", $dbz);
if (!$conn) {
    $e = oci_error();
    trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
} else {
    echo "Successfully connected to Oracle database!";
}
?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM