1

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;


?>
2
  • Is the OCI8 extension enabled? Commented Aug 11, 2016 at 14:21
  • @Fairy I removed the ; before the extension=php_oci8_11g.dll within php.ini file Commented Aug 11, 2016 at 14:28

3 Answers 3

1

Please ensure you have OCI8 extension enabled. check output of phpinfo() or extension_loaded ('extension name') or in CLI php -m

Sign up to request clarification or add additional context in comments.

6 Comments

I removed the ; before the extension=php_oci8_11g.dll within php.ini file and at phpinfo() the page is loaded but i dont really understand what do i hvae to check please ?
Once you have enabled extension (removed ; before extension name in php.ini) restart apache and try run you script.
same error Call to undefined function oci_connect()
Please see Installing OCI8 on Windows section for details, hope this helps.
thanks for your help ill check again in hope to find out what the problem >
|
1

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

3 Comments

I tried to use your code instead of my and i got error message said could not find driver
does it apply to xampp Apache server ?
0

problem solved by following details steps within below youtube.com tutorial

youtube link

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.