Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Connect php to oracle

Connect php to oracle

From: Tore Skogly <tore.skogly_at_no.spam.invalid>
Date: Wed, 07 Jan 2004 23:55:52 +0100
Message-ID: <1073516151.177608@gurney>


I am running php 4.3.3 on Windows 2000 server/IIS5. I have not yet been able to connect PHP to my Oracle 9 database running on another server.
I have installed Oracle Client software on the server. When I try to run this php test page:



<?php
  echo"Connection Test";
  PutEnv("ORACLE_HOME=C:\oracle\ora92");
  PutEnv("TNS_ADMIN=C:\oracle\ora92\network\admin");
  PutEnv("TWO_TASK=C:\oracle\ora92\network\admin\tnsnames.ora");

$db="

  (DESCRIPTION =
    (ADDRESS_LIST =
        (ADDRESS = 
          (PROTOCOL = TCP) 
          (Host = <server ip>) 
          (Port = 1521)) 

    )
    (CONNECT_DATA = (SID = newdb2)))";

$c = OCILogon("user", "password");

if ($c) {
  echo "Successfully connected to Oracle.\n";   echo "LOGON";
  ocilogoff();

} else {
$err = ocierror();

  echo "Oracle Connect Error " . $err[0]; }
?>



I get the following output:

Connection Test
Warning: ocilogon(): _oci_open_server: Error while trying to retrieve text for error ORA-12538 in c:\inetpub\wwwroot\oci8test.php on line 17 Oracle Connect Error  

When I try tnsping it tells me everything is up and running, and connecting to the Oracle database with sqlplus from the Windows server works fine.

Environment settings TNS_ADMIN and ORACLE_HOME have been set using "My Computer" -> "advanced" ->.... too.

Connecting to an MSSQL database works perfectly.

I hope someone out there can help me with a solution to this problem? I have spent far too many hours trying to figure it out on my own...

-- 
regards,
Tore Skogly,Norway
E-mail:tskogly_at_start.no
Received on Wed Jan 07 2004 - 16:55:52 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US