Click to See Complete Forum and Search --> : PHP can't connect to oracle


Anon
02-07-2001, 06:04 PM
Hi...

I work in a linux machine with red hat 6.0 distribution, php version 4 and oracle 8.1.5

I have tested php and it is ok.. apache is ok and oracle too..

but, when i try to connect to oracle from php I get an error.. I've been trying with OCI_Logon but i get an error.. it's an authentication page that asks for the user and password to get in..

this is the result:

------------
Hi prueba

Your password is prueba

initializing the connection...

Warning: _oci_open_server: ORA-12547: TNS:lost contact in /usr/local/apache/htdocs/prueba7.php on line 22

It was not possible to make the connection

----------

I have tried loading the oracle user variables before apache environment variables.. but it didn't work either..

any suggestion??

Anon
02-07-2001, 11:20 PM
Example code is good.

Anon
02-08-2001, 06:20 AM
take the string from tns names and plave that in your oracle like on ocilogon(user,pass,stringfromtnsnames)

<? function connectoracle($user,$pass)
{
$oralink = "(DESCRIPTION = (FAILOVER=ON) (LOAD_BALANCE=OFF)(ADDRESS=(PROTOCOL=TCP)(HOST=172.10.40.16)(PORT=1521)) (CONNECT_DATA=(SID=hits) ) )";

$connd = ocilogon('HITS','HITS',$oralink);
return $connd;
}