Re: PHP+Oracle: could not resolve service name
Date: Thu, 10 Apr 2008 12:17:54 +0200
Álvaro G. Vicario escribió:
> I'm developing a PHP 4 application in a Windows Server 2003 box. I'm
> connecting to a remote Oracle 10g server using ODBC (with a system-wide
> DSN). I didn't install any of the software and my Oracle experience doesn't
> got further than writing queries ;-)
> My issue is that PHP scripts cannot connect to the database server when I
> run them from the *command line*. I get this error message:
> SQL error: [Microsoft][ODBC driver for Oracle][Oracle]ORA-12154: TNS:no
> se ha podido resolver el nombre del servicio, SQL state 08001 in SQLConnect
> Which translates into English as "could not resolve service name".
> The *very same code* runs fine when parsed through the web server (Apache2 +
> PHP module running as LocalSystem) and I've found no problems using TOAD.
> Apart from environment, PHP configuration is identical in command line and
I've gathered some more info using Systernal's Filemon utility. It seems that phpcli.exe does ask Windows about my TNSNAMES.ORA file; Windows replies that the file exists. But PHP does not even try to read it. It only reads the following file:
AUTOMATIC_IPC = OFF TRACE_LEVEL_CLIENT = OFF names.directory_path = (TNSNAMES) # names.default_domain = world # name.default_zone = world
The only files it searches and is not found is:
There isn't a sdns.ora file anywhere on disk.
When I run the same script through mod_php then Apache.exe opens *and reads* TNSNAMES.ORA :-? Received on Thu Apr 10 2008 - 05:17:54 CDT