[PHP] php4 can't find tnsnames.ora oracle9 but can connect if description hardcoded

2005-04-19 Thread neil smith
Hello,
I have test script that can connect to the oracle database. It doesn't 
require tnsnames.ora because I define the database alias in the script 
itself. It looks like this:


echo TWO_TASK=.getenv(TWO_TASK).br;
echo LD_LIBRARY_PATH=.getenv(LD_LIBRARY_PATH).br;
echo ORACLE_BASE=.getenv(ORACLE_BASE).BR;
echo ORACLE_HOME=.getenv(ORACLE_HOME).BR;
echo TNS_ADMIN=.getenv(TNS_ADMIN).BR;
echo NLS_LANG=.getenv(NLS_LANG)..br;
# this allows a successful connection
$db =   (DESCRIPTION =
 (ADDRESS = (PROTOCOL = TCP) (HOST =testdb.boo.com)(PORT = 1521))
 (CONNECT_DATA= (SID = testdb))
 );
// these don't work.. php can't seem to find tnsnames.ora
# $db = testdb.boo.com;
//$db = testdb.boo.com;
# $db = testdb;
//echo $testdb;
$odbc = OCILogon(test/test,test,$db);
if ($odbc == false){
  $msg = OCIError($odbc).BR;
} else {
echo success!!!br;
}

My problem is is that when I try to use the database alias in tnsnames.ora I 
get an ora-12154 error. I get this despite the facts that oracle_home, 
tns_admin and everything else is defined in the script and the tnsnames.ora 
contains exactly the same alias as I use in the hardcoded version (see the 
uncommented $db above).
sqlnet.ora contains a value name_domain that apparently is appended to the 
alias in tnsnames.ora but accounting for this still doesn't let me connect 
to oracle . It's as if tnsnames.ora cannot be found. I've changed the 
permissions to 777 for the whole directory structure and I can successfully 
use tnsnames.ora with sqlplus or tnsping.

Does anybody have any ideas what is going wrong? Is this a bug?
thanks,
neil
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] fsockopen fails if port blocked by firewall - PHP 4.0.6 / Apache / Linux

2002-11-04 Thread neil smith
Hello List -

I am having a problem with fsockopen since my ISP upgraded their linux 
server. The same function works just fine on another linux server and PHP 
version (using a different ISP).

This fsockopen function previously worked as expected, returning within the 
specified timeout (2 sec) if a socket connection attempt to client is 
rejected, eg by a firewall.
For connection to port 1720, (then immediate close of socket if fsockopen 
returns true) I use :

$fsock=fsockopen( $address, 1720 , $errno, $errmesg , 2);

I have also tried 2.0 (float) rather than 2 as per PHP manual, this makes 
no difference.
http://www.php.net/manual/en/function.fsockopen.php

The specific symptoms :

No listener on client port 1720 : 		Succeeds
Listening client socket on port 1720		Succeeds
Client firewall configured to allow connections 	Succeeds
Client firewall configured to deny connections 	Fails

The fail mode is that fsockopen does *not* return after the specified 
timeout, and the script itself eventually times out at the default 30 sec.

Working configuration : 	PHP 4.1.2, Linux Redhat 2.2.20, Apache 1.3.22
Http Env vars :i386-redhat-linux-gnu

Non-working configuration : 	PHP 4.0.6, Linux Redhat 2.4.9-21smp i686, 
Apache 1.3.27
Http Env vars : i386-slackware-linux-gnu

Anybody able to offer any help or point me at a way to step round this 
problem ? I thought of setting up an XML feed by HTTP Post from one machine 
to another - they are on diffrent networks so I worry about latency.

Thanks for any help or suggestions to fix this problem, or any anecdotal 
evidence I can use to fix it !!

Neil Smith. 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php