Re: ERROR ORA-12154 TNS: could not resolve the connect identifier specified

From: Álvaro G. Vicario <>
Date: Thu, 16 Oct 2008 10:40:48 +0200
Message-ID: <gd6umo$coq$>

beta escribió:
> #### OUT put
> # php oraConnect.php
> AD_PRES President 20000 40000 <br>
> AD_VP Administration Vice President 15000 30000 <br>
> #### browser
> http://localhost/oraConnect.php
> Warning: ocilogon() [function.ocilogon]: ORA-12154: TNS:could not
> resolve the connect identifier specified in /opt/www/oraConnect.php on
> line 2

I once got the opposite problem (it worked in web but not in command line). The issue got fixed when I opened tnsnames.ora in a text editor and changed the style of line feeds from Windows to Unix (it was a Windows box, anyway). It sounds stupid but...

BTW, the function names you are using in your PHP code are deprecated. Rather than OCIExecute() use oci_execute(), etc. Also, do some error checking in your code. Don't let the script proceed till the end when it can't even connect to the database.

-- - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web:
-- Mi web de humor al baño María:
Received on Thu Oct 16 2008 - 03:40:48 CDT

Original text of this message