Sorry to bring back an old thread but I get the same error message "ORA-12154: TNS:could not resolve the connect identifier specified" When I simply try to connect in my php script using a SID.
Basically I can connect fine with sqlplus using the sid. I can connect with php if I supply the full string. But when I use the alias/SID with php it gives me this error.
I am 90% sure php see's the tnsnames.ora file because I get a different error if I use SERVICE_NAME instead of SID in the connection string.
I am using Red Hat Enterprise Linux 5, Apache 2.2 and PHP 5.2.9. Basically trying to setup a new server.
I use this script to setup my ENV Variables:
#!/bin/sh
service httpd stop
LD_LIBRARY_PATH=/usr/lib/oracle/11.1/client/lib:${LD_LIBRARY_PATH}
TNS_ADMIN=/home
NLS_LANG=AMERICAN_AMERICA.UTF8
export LD_LIBRARY_PATH TNS_ADMIN NLS_LANG
echo Starting Apache
service httpd start
Appreciate the help. Thanks