Reputation: 193
I am using XAMPP version 5.6.15 to run my PHP file on windows 10.
But I am getting this error message:
Fatal error: Call to undefined function oci_connect() in F:\xampp\htdocs\Sbank\index.php on line 4
According to PHP docs everything should work fine.
<?php
$conn = oci_connect('admin', 'admin', 'localhost/JDT');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
$stid = oci_parse($conn, 'SELECT sysdate FROM dual');
oci_execute($stid);
echo $stid;
?>
Upvotes: 1
Views: 1949
Reputation: 193
problem solved by following details steps within below youtube.com tutorial
Upvotes: 0
Reputation: 1325
If instant client has been installed but the full oracle client not yet ,you can use pdo to connect to oracle database like following coding:
<?php
$tns = "
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = yourip)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
";
$db_username = "youname";
$db_password = "yourpassword";
try{
$conn = new PDO("oci:dbname=".$tns,$db_username,$db_password);
}catch(PDOException $e){
echo ($e->getMessage());
}
?>
Source : http://php.net/manual/en/ref.pdo-oci.php
Upvotes: 1
Reputation: 341
Please ensure you have OCI8 extension enabled.
check output of phpinfo()
or extension_loaded ('extension name')
or in CLI php -m
Upvotes: 1