Skip to Main Content

DevOps, CI/CD and Automation

Connect PHP with Oracle 11g

35cc8112-d4eb-427f-af86-afd9de5a0ac1Sep 20 2018 — edited Sep 20 2018

I am trying to connect to a remote oracle database from an IIS machine using PHP. Starting very basic my code is

<!DOCTYPE html>

<?php

if ($conn = oci_connect(username, passowrd, server:port/instance')
{
    echo 'Successfully connected to Oracle Database!';    
}
else
{
     $errmsg = oci_error();
     echo 'Oracle connection failed' . $errmsg['message'];
}
?>

I can connect to the oracle db using sql developer and the command prompt.

But every time I attempt a connection using this code I get an error "Fatal PHP error: call to undefined function oci_connect() in c:\inetpub\wwwroot\connection.php on line 3"

I can run a basic html and PHP page on the machine.

So, I tried to check my PHP info on command prompt and I got another error which,"PHP Startup: Unable to load dynamic library 'C:\PHP\ext\php_oci8_12c.dll'"

any help to start me on the proper path is great.

I have oracle instant client installed: c:\oracle\instantclient_12_1\

I have oracle PHP installed: c:\PHP

My website and PHP code is located at: F:\ inetpub\wwwroot\

Thanks,

Post Details
Locked on Oct 18 2018
Added on Sep 20 2018
0 comments
676 views