Ardor
Ardor

Reputation: 23

Fatal error: Uncaught Error: Call to undefined function oci_connect()

I am having problems with oci_connect() in PHP. I can't connect with an Oracle Database, after I had installed the Oracle InstantClient(32 Bit) and copied the required *.dll's in the apache/bin/ and xampp/php folders.

I get this:

Fatal error: Uncaught Error: Call to undefined function oci_connect() in C:\xampp\htdocs\OracleTest\connect.php:9 Stack trace: #0 {main} thrown in C:\xampp\htdocs\OracleTest\connect.php on line 9.

There is also the Problem that I am unable to load the dynamic libraries:

PHP Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_oci8_11g.dll' - The specified module could not be found. in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_oci8_11g.dll' - The specified module could not be found. in Unknown on line 0

My Code is this:

$oc_conn = oci_connect('127.0.0.1/XE','****', '****');
    if($oc_conn)
    {
        echo "Success!!!";
    }
    else
    {
        $e = oci_error();
        trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
    }

I am struggling on that Problem for over 3 weeks..I really need help, thank you in advance.

Upvotes: 0

Views: 4185

Answers (1)

CodeBoy
CodeBoy

Reputation: 3300

The "Call to undefined function oci_connect()" seems to be a secondary error resulting from a root cause error. The root cause error, as the error message says, seems to be that PHP cannot find the file named C:\xampp\php\ext\php_oci8_11g.dll. PHP will get this file name from the extension=php_oci8_12c.dll statement in your php.ini. It also seems that your php.ini has defined C:\xampp\php\ext\ as the place where extension code should be located.

FIX: Make sure the .dll is in C:\xampp\php\ext\, not just apache/bin. Also, make sure the name of the .dll is php_oci8_11g.dll, not oci.dll.

Successfully loading a dynamic library / extension will (usually) make new functions and classes available to your PHP code. Once you've got php_oci8_11g.dll loaded, you'll probably find that the oci_connect() error is fixed too.

Upvotes: 1

Related Questions