Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: PHP and Oracle 8i
Hi
You should set the variable
TNS_ADMIN="/usr/local/oracle/8i/u01/app/oracle/product/8.1.5/network/admin".
The variable TWO_TASK and ORACLE_SID are not needed, as you you tell the instance in
the OCOLogon call. (test)
Probably you shouldn't need set even TNS_ADMIN...
rgrds
Kari Pannila
Oracle DBA (OCP)
TietoEnator Corp - Telecom
Ivo Jansch wrote:
> Hello,
>
> we're trying to use PHP (4 beta, patchlevel 1) to connect to our oracle
> 8i (8.1.5) database. Both are running on the same machine, a Redhat
> Linux 6.1 box.
>
> The code we used:
>
> <?
>
> putenv("ORACLE_HOME=/usr/local/oracle/8i/u01/app/oracle/product/8.1.5");
> putenv("ORACLE_SID=test");
>
> putenv("TWO_TASK=/usr/local/oracle/8i/u01/app/oracle/product/8.1.5/network/admin");
>
> $c1 = OCIlogon("scott","tiger","test");
>
> print OCIServerVersion($c1);
> print "<br>";
>
> $query = "select name from customer";
> $stmt = ociparse($c1,$query);
> ociexecute($stmt);
>
> ocifetchinto($stmt,&$result,OCI_NUM);
> $all = sizeof($result);
>
> for($i=0;$i<$all;$i++) {
> print $result[$i];
> print "<br>";
> }
> ocilogoff($c1);
> ?>
>
> When I run this code, I get the following error:
>
> Warning: OCIStmtExecute: ORA-03106: fatal two-task communication
> protocol error in /var/www/test/index.php3 on line 13
>
> Now the strange thing is, if I select a numeric field from the database,
> like customerid, it works fine!!
>
> I checked a few things:
> - If I execute the same query, "select name from customer", in for
> example sqlplus, it works fine.
> - The TWO_TASK variable that is set at the start of the file contains a
> correct tnsnames.ora file.
>
> Anyone any idea what's wrong here?
>
> Greetings,
> Ivo
--
Delete X to get working mail address... Received on Mon Mar 27 2000 - 04:29:50 CST