|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36649 ORA-12154: using Oracle 9i
Submitted: 2006-03-07 22:36 UTC Modified: 2006-03-08 13:10 UTC
From: madlybad at hotmail dot com Assigned:
Status: Closed Package: OCI8 related
PHP Version: 5.1.2 OS: Windows XP Pro SP2
Private report: No CVE-ID: None
 [2006-03-07 22:36 UTC] madlybad at hotmail dot com
My configuration to connect to Oracle 9i is correct. I am able to connect to Oracle 9i using SQLPLus and TOAD. But using PHP I am unable to connect to Oracle this error appears "ORA-12154: TNS:could not resolve the connect identifier specified".

Reproduce code:

  $conexion = oci_pconnect('TIENDAS','tiendas','DAVID');//('hr', 'hr', 'orcl');
  if (!$conexion) {
    $e = oci_error();
    echo "Error al Conectarse";
    print htmlentities($e['message']);

  $consulta = 'SELECT * FROM promotoras_tda';

  $id_sentencia = oci_parse($conexion, $consulta);
  if (!$id_sentencia) {
    $e = oci_error($conexion);
    echo "Error al Parsear";
    print htmlentities($e['message']);

  $r = oci_execute($id_sentencia, OCI_DEFAULT);
  if (!$r) {
    $e = oci_error($id_sentencia);
    echo "Error al Ejecutar la Conuslta";
    echo htmlentities($e['message']);

  print '<table border="1">';
  while ($fila = oci_fetch_array($id_sentencia, OCI_RETURN_NULLS)) {
    print '<tr>';
       foreach ($fila as $item) {
         print '<td>'.($item?htmlentities($item):'&nbsp;').'</td>';
       print '</tr>';
  print '</table>';


Expected result:

Actual result:
ORA-12154: TNS:could not resolve the connect identifier specified


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-08 07:23 UTC] cjbj at hotmail dot com
The bug system is not the best place to ask this question.

Refer to notes like
and check all your environment variables - e.g. ORACLE_HOME - are set correctly in the shell environment that starts the web server.
 [2006-03-08 08:23 UTC]
The error you get comes from Oracle client libs -> not PHP problem.
 [2006-03-08 13:10 UTC] madlybad at hotmail dot com
Using this code I fixed the problem:

                      (HOST =

  $conexion = oci_pconnect("user","password",$db);

But I have to use oci_pconnect() and not oci_connect. If I used oci_connect(), PHP CGI crash. I would like to know why. Or maybe open a new Bug about this. Please let me know is I should open it.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jul 25 17:01:27 2024 UTC