Re: [PHP-DB] PHP Windows/Oracle DB Problem From: Robert Schultz (robert.schultz <email protected>)
Date: 11/29/00

Turns out that the client version was the problem.

I removed Oracle Client 8.0.5 (that was a LOT of work)
Then installed a fresh Oracle Client 816 version client.

Now the ODBC code works just great!

Thanks a lot!

Robert Schultz - robert.schultz <email protected>
Knowledge Engineer - Adelphia Communications
  ----- Original Message -----
  From: Vince LaMonica
  To: Robert Schultz
  Cc: php-db <email protected>
  Sent: Tuesday, November 28, 2000 1:01 PM
  Subject: Re: [PHP-DB] PHP Windows/Oracle DB Problem

  On 2000-11-28, Robert Schultz stated:

  } I'm having severe problems trying to get a database connection to work under
  } windows using PHP.

  First off, are you using php4 from http://www.php4win.de/ ? This has oci8
  functions built in, though it does look like you are loading oci8
  functions ok due to the error message you're receiving [if you got an
  error message that complained about an unknown function, then the dll
  wouldn't be loading correctly].

  } I have a Windows 2000 box running Oracle 8.0.5 (DAFFY)
  }
  } I then have another Windows 2000 box (DEVBOX) running Inetinfo, PHP 4..
  } Installed on DEVBOX is the Oracle 8 Client and ODBC.

  Is the Oracle 8 client an 8.1.6 client? That makes a pretty big
  difference, as php4win was compiled with 8.1.6. You can get the client
  free from Technet on Oracle.com. Are you running apache on this box?

  } This is the entry as it stands in tnsnames.ora
  } DAFFY.WORLD =
  } (DESCRIPTION =
  } (ADDRESS = (PROTOCOL = TCP)(HOST = daffy)(PORT = 1521))
  } (CONNECT_DATA = (SID = ORCL))
  } )

  Do you have a sqlnet.ora file that looks something like this?:

  TRACE_LEVEL_CLIENT = OFF
  names.directory_path = (TNSNAMES)
  names.default_domain = world
  name.default_zone = world

  } $database = OCILogon("dbman", "password", "DAFFY.WORLD");

  "DAFFY.WORLD" should just be "daffy", but I know you already tried that
  w/o success.

  } This code produces the following error:
  } Warning: _oci_open_server: ORA-12154: TNS:could not resolve service name in
  } f:\inetpub\wwwroot\oracle.php on line 3
  } Unable to connect!

  If you're using apache, you need to define your ORACLE_HOME and your
  TNS_ADMIN directories in your httpd.conf file, via:

  SetEnv TNS_ADMIN "D:\ora816\network\admin"
  SetEnv ORACLE_HOME "D:\ora816"

  Note that if using apache, the drives your TNS_ADMIN and ORACLE_HOME are
  located on *must* be local. They can not be a network drive.

  Although at one point I thought I needed to also set these two vars in my
  "System Properties" -> "Environment" -> "System", I am successfully
  running an NT4 Server without these entries in the registry [and both
  apache and IIS4 are able to connect to the oracle 7.3.4 db via the 8.1.6
  client installed on the NTS box].

  Also, make sure that when you installed the Oracle 8.1.6 client you
  installed the OCI8 features, otherwise php will be unable to talk to the
  Oracle db.

  HTH,

  /vjl/