On Fri, 9 Feb 2001, Steve Farmer wrote:

> but tnsping only tells you that the listeners is running, not that 
> you can connect to the database...

True.  I forgot to mention I can connect using sqlplus or any other oracle
based apps just fine.

> BTW i'm not sure if  putenv("ORACLE_HOME=D:\PROGRA~1\ORAWIN95");  is 
> ok, i think you should put the full path name in without any ~

I'm only using 8 char path, so thats not an issue.

> Otherwise it must be something to do with the way php has been compiled ...

Thats my guess.  Watching with a file/registry tracing tool during a
run the Oracle DLL's within PHP checks for the presence of the
tnsnames.ora file but never reads it. Instead it just tries to
connect to BEQlocal according to the sqlnet.log files.  Adding the ENV
variable ORACLE_SID causes it to try to connect to that sid on BEQlocal.


> if you do a phpinfo()  do all the environment variables look OK and 
> is OCI8 support complied ?

Yes. 

> I have connected remotely from linux/apahe to a variety of oracle 
> DB's on a variety of remote platforms

Once I gave up on windows I moved the whole mess over to Linux and had
none of the same problems.  Only problem I had was caused by me being too
lazy to recompile Apache.  Nothing Oracle related.

If anyone has succeeded in connecting to a remote Oracle db under windows
I'd
like to hear about it.

Thanks


> Steve Farmer
> 
> At 4:39 PM -0600 8/2/01, Mark Farver wrote:
> >  > Please help. I'm going maaddd trying to figure this out. I've pretty much
> >>  read all of the online docs and spend countless hours reading through the
> >>  archives..
> >>
> >>  I'm running PHP4 and Apache on my Win95 computer.
> >>  I'm trying to connect to a remote Oracle database.
> >
> >I had the same problem last week.  Every suggestion I got was about
> >environment variables.   However since a tnsping from within PHP
> >(using passthru) works fine I know better.  From examining the sqlnet
> >files and watching the resource allocations I came to the conclusion that
> >PHP is hardcoded to connect only to a database located on the same
> >machine (using BEQLOCAL).  Oracle never even bothers to read the
> >tnsnames.ora file when its called from PHP.  This seems to be only a
> >problem in Windows and possibly only with the Oracle8 drivers. 
> >
> >My postings to the dev lists went unanswered but at the time I was unsure
> >if it was a Windows only problem.  It might be worth reposting this info
> >to the PHP-WIN list.
> >
> >My boss was very unhappy when I told him my code had to run on a Unix
> >box.. I basically sold him on PHP due to is cross-paltform nature.
> >
> >ODBC might work instead, although it never did for me. Use ADODB or
> >another abstraction layer.. this way you can switch back and forth easier.
> >
> >Let me know if you figure anything else out.
> >
> >Mark Farver
> >[EMAIL PROTECTED]
> >
> >On Thu, 8 Feb 2001, Jorge Santos wrote:
> >
> >>  Hi all,
> >>
> >>
> >>  I'm getting a "Warning: _oci_open_server: ORA-12203: TNS:unable to 
> >>connect to destination ..." error message. Yet I know the 
> >>environment is ok because I can tnsping the database name and I can 
> >>connect using SQL Plus to the database.
> >>
> >>  Here's the php code:
> >>
> >>  <?php
> >>   putenv("ORACLE_SID=MDC6");
> >  >  putenv("ORACLE_HOME=D:\PROGRA~1\ORAWIN95");
> >>   putenv("TNS_ADMIN=D:\PROGRA~1\ORAWIN95\NET80\ADMIN");
> >>
> >>   $tns = "(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL 
> >>=TCP)(HOST = njnwkora15.db.pseg.com)(PORT = 1527)))  (CONNECT_DATA 
> >>= (SID =MDC6) ) )";
> >> 
> >>   $connect=OCIPLogon("MDC","MDC",$tns) or die("It's not possible to 
> >>connect");
> >> 
> >>   $sql = "select * from district";
> >>
> >>   $result =OCIParse($connect,$sql);
> >>   OCIExecute($result) or die("It's not possible to query");
> >>
> >>   echo("<TABLE>");
> >>   while(OCIFetch($result)) {
> >>       $CC = OCIResult($result,1);
> >>       $CCNome = OCIResult($result,2);
> >>       echo('<TR><TD>' . $CC . '</TD><TD>' . $CCNome . '</TD></TR>');
> >>   }
> >>   echo("</TABLE>");
> >>  ?>
> >>
> >>  I shouldn't need to declase $tns above but I've tried with and 
> >>without it. I'm also including the ORACLE_SID, ORACLE_HOME and 
> >>TNS_ADMIN variables in the autoexec.bat so that they are declared 
> >>as of machine bootup. I also added them to the httpd.conf for 
> >>Apache configuration like this:
> >>
> >>  SetEnv ORACLE_SID MDC6
> >>  SetEnv ORACLE_HOME D:\PROGRA~1\ORAWIN95
> >>  SetEnv TNS_ADMIN D:\PROGRA~1\ORAWIN95\NET80\ADMIN
> >>
> >>
> >>  Please help.... Before I switch to ASP...
> >>  Later,
> >>  Jorge
> >>  [EMAIL PROTECTED]
> >>
> >
> >--
> >"The greatest dangers to liberty lurk in insidious enroachment by mean of
> >zeal, well-meaning but without understanding."
> >-- Justice Louis O. Brandeis, Olmstead vs. United States
> >
> >
> >--
> >PHP Database Mailing List (http://www.php.net/)
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 

-- 
"The greatest dangers to liberty lurk in insidious enroachment by mean of
zeal, well-meaning but without understanding."
-- Justice Louis O. Brandeis, Olmstead vs. United States


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to