tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: "MacDonell, Dennis" <DennisMacDonell () auslig ! gov ! au>
To: tru64-unix-managers
Subject: connecting to an Oracle database from a php script via a web serv	er.
Date: Mon, 22 Apr 2002 05:57:41 +0000	[thread overview]
Message-ID: <102653755322526.tru64-unix-managers.marc@archive.invalid> (raw)


Hi, 

I have setup php+mysql+oracle+apache on a Tru64 v5.1A installation with
oracle 8.1.7. The following sources were used -
autoconf-2.52
flex-2.5.4
php-4.1.2
automake-1.5
make-3.79.1
apache_1.3.23
bison-1.34
mysql-3.23.49.OSF1

I can run phpinfo(), and I have run ldd -r on httpd and checked that it has
a couple of oci8 library entries, but I can't get the following script to
work (adapted from the online manual) 
***********************
<html>
<body BGCOLOR="#FFFFFF">

<?php
  putenv("LD_LIBRARY_PATH=/oracle_home/lib");
  putenv("ORACLE_HOME=/oracle_home");
  putenv("ORACLE_SID=ARC");

  /* OCIDefineByPos example thies@thieso.net (980219) */
  $db = "lando";

  $conn = OCILogon("test","oratest", $db);

  $stmt = OCIParse($conn,"select city, country from location");

  /* the define MUST be done BEFORE OCIexecute! */

  OCIDefinebyname($stmt,"CITY",$city);
  OCIDefinebyname($stmt,"COUNTRY",$country);

  OCIExecute($stmt);

  while (OCIFetch($stmt)) {
      echo "city:".$city."\n";
      echo "country:".$country."\n";
  }

  OCIFreestatement($stmt);
  OCILogoff($conn);
?>

</body>
</html>
**********************
What I get is the following 
**********************
Warning: _oci_open_server: ORA-12154: TNS:could not resolve service name in
/www/Oracle/oracleoci.php on line 24

Warning: Supplied argument is not a valid OCI8-Connection resource in
/www/Oracle/oracleoci.php on line 26

Warning: Supplied argument is not a valid OCI8-Statement resource in
/www/Oracle/oracleoci.php on line 30

Warning: Supplied argument is not a valid OCI8-Statement resource in
/www/Oracle/oracleoci.php on line 31

Warning: Supplied argument is not a valid OCI8-Statement resource in
/www/Oracle/oracleoci.php on line 33
Warning: Supplied argument is not a valid OCI8-Statement resource in
/www/Oracle/oracleoci.php on line 36
*****************
The line numbers may not align because I have deleted a few lines from what
is shown of the script. I stopped the listener and created a file called
/oracle_home/admin/tnsnames.ora which contained the following
*****************
lando = (DESCRIPTION=
          (ADDRESS=
            (PROTOCOL=TCP)
            (HOST=lando)
            (PORT=1521))
        (CONNECT DATA=
            (SID=ARC)))
******************
and then restarted the listener, but alas that did not make any difference.
I was wondering if a knowledgeable person could shed some light on what is
missing.
Dennis


######################################
Dennis Macdonell
Systems Administrator
National Mapping Division, Geoscience Australia
mail: PO Box 2, Belconnen, ACT 2617
email: mcdonell@auslig.gov.au
ph:  61 2 6201 4326
fax: 61 2 6201 4377
######################################

                 reply	other threads:[~2002-04-22  5:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox