php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13826 Oracle connection (cliente Oracle8i 8.1.6.0.0)
Submitted: 2001-10-25 11:51 UTC Modified: 2001-10-25 18:37 UTC
From: palbano at tmn dot pt Assigned:
Status: Not a bug Package: OCI8 related
PHP Version: 4.0.5 OS: windows 2000
Private report: No CVE-ID: None
 [2001-10-25 11:51 UTC] palbano at tmn dot pt
//CODE
function ligaGAV() {
//   return odbc_connect("gavdsn","gav_gestor","gestor");
   putenv("ORACLE_SID=gaviao");
   putenv("ORACLE_HOME=d:/orant/");

   echo getenv("ORACLE_SID") . "<br>\n";
   echo getenv("ORACLE_HOME") . "<br>\n";

   $conn = ora_logon("gav_gestor@gaviao","gestor");

   return $conn;

}//end function ligaGAV()

/* ==============================================================================
Funcao: deligaOrcl
Descricao: Recebe o identificador da ligacao Oracle a desligar.
Criacao: 2001-10-25
Autoria: Patricia Albano (TMN)

============================================================================== */
function desligaOrcl($idLig) {
   //odbc_close($idLig);
   ora_logoff($idLig);
}//end function desligaOrcl


function contaReclamacoes() {

   $odbcOrcl = ligaGAV();

   if ($odbcOrcl) {
      echo "Ligacao ORCL<br>\n";

      $cur = ora_do($odbcOrcl,"SELECT COUNT(*) FROM gareclamacao");
      if ($cur) {
         echo ora_getcolumn($cur,0);
      } else {
      }


   } else {
      echo "ERRO: " . ora_errorcode($odbcOrcl) . " - " . ora_error($odbcOrcl) . "<br>\n";
   }//end if ($odbcOrcl)

   desligaOrcl($odbcOrcl);
}
-----------------------------------------------------------~
Extension php_oracle.dll instaled

Problem: first time the script is runned with Apache, there is no problem. Second time I get: 
Warning: Oracle: Connection Failed: ORA-12154: TNS:could not resolve service name in d:\program files\apache group\apache\htdocs\indicadores\includes\trataorcl.php on line 29

Warning: Supplied argument is not a valid Oracle-Connection/Cursor resource in d:\program files\apache group\apache\htdocs\indicadores\includes\trataorcl.php on line 63

Warning: Supplied argument is not a valid Oracle-Connection/Cursor resource in d:\program files\apache group\apache\htdocs\indicadores\includes\trataorcl.php on line 63
ERRO: - 

Warning: Supplied argument is not a valid Oracle-Connection resource in d:\program files\apache group\apache\htdocs\indicadores\includes\trataorcl.php on line 44

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-25 18:37 UTC] sniper@php.net
Set those environment variables for the Apache. 
In linux you would set them before starting Apache,
but I don't know how it's done in Windows.

This is not a bug.

Ask further support questions on the mailing lists:

http://www.php.net/support.php

Also this manual page has some solutions mentioned in
the user contributed notes:

http://www.php.net/oci8

--Jani

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 10:01:28 2024 UTC