The Dreaded Oracle 8 TNS:ORA-12154 Connection Error
| From: | Paul | Date: | Tue, 08 May 2001 03:30:08 +0000 |
| Subject: | The Dreaded Oracle 8 TNS:ORA-12154 Connection Error | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-9160@lists.php.net to get a copy of this message | ||
I am running PHP 4.0.4pl1 in CGI mode on Windows NT4 SP6, using Apache or IIS Web Server's.
I am concentrating on Apache for this problem as it is identical irrespective of the Web Server.
I'm using one of the simplest possible connection mechanisms ...
if ($conn=Ora_Logon("user@mydatabase","pass"))
{
echo "SUCCESS ! Connected to database\n";
Ora_Logoff($conn);
}
else
{
echo "Failed :-( Could not connect to database\n";
}
This works fine if PHP is run as an apache module but fails with the message
"Warning: Oracle: Connection Failed: ORA-12154: TNS:could not resolve service name in
c:\program files\apache group\apache\htdocs\ora.php on line 10"
When Apache is re-configured to run PHP as CGI (other html on the same page suce as phpinfo() shows
up just fine).
At first I thought the Apache user may have been affecting privileges but the Apache
"User" option doesn't work under Windows & I even tried running Apache as a
service using the Administrator
account - no change. Have tried environment paths to ORACLE_HOME, TNS_PATH etc. etc. etc. all to no
avail. We use sqlnet.ora with an oracle name server.
I have to use CGI as PHP4 isn't to production level for use as a Filter with IIS &
corporate policy dictates that I must prove PHP against ASP on the existing IIS server before I can
even attempt using
Apache.
I would greatly appreciate any construction :-) advise anyone can offer.
Regards, Paul Shortis