Re: PHP+Oracle: could not resolve service name
Date: Wed, 9 Apr 2008 21:34:51 +0200
"Álvaro G. Vicario" <alvaro_NOSPAM_at_demogracia.com> schreef in bericht
> 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
> 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 web.
> After some Googling I've tried setting TNS_ADMIN and ORACLE_HOME
> environmental variables but it didn't make any difference. I just can't
> understand why all programs can connect except command line PHP. Do you
> have any clue?
> Sample code:
> define('DB_DSN', 'FOO');
> define('DB_USERNAME', 'FOO');
> define('DB_PASSWORD', 'FOO');
> odbc_connect(DB_DSN, DB_USERNAME, DB_PASSWORD);
What did you set TNS_ADMIN to? Where is your TNSNAMES.ORA?
Shakespeare Received on Wed Apr 09 2008 - 14:34:51 CDT