ID:               31038
 Updated by:       [EMAIL PROTECTED]
 Reported By:      damien dot harper at keops dot net
 Status:           Assigned
 Bug Type:         OCI8 related
 Operating System: Red Hat 8
 PHP Version:      4.3.10RC2
 Assigned To:      tony2001
 New Comment:

I bet it's still the same issue as always: missing environment variable
definitions for webserver. (as it works fine with CLI..)



Previous Comments:
------------------------------------------------------------------------

[2004-12-14 22:00:40] [EMAIL PROTECTED]

Give me some time for testing.
ATM I can tell only that Apache2 is not recommended for production
environment and this will not be changed in the nearest future. At
least, you should use prefork if you have to stick with Apache2.

------------------------------------------------------------------------

[2004-12-14 19:52:14] damien dot harper at keops dot net

I'd prefer to stick with 4.x.x branch for compatibility.
It will be used on a production server and we can't loose time to check
that everything is OK with PHP 5.x now.

Nobody has any idea how to solve this trouble ?

------------------------------------------------------------------------

[2004-12-14 19:33:33] [EMAIL PROTECTED]

Are you able to try latest release from 5.0.x branch?

------------------------------------------------------------------------

[2004-12-14 18:57:24] damien dot harper at keops dot net

Wooops, I forgot the interesting part of the included file
fonctionsDb.php :

<?php 
...
function connection(){
        global $errorCode,$test;

        $host = "172.16.0.7";
        $port = "1521";
        $service = "ORACLE9";
        $user = "sirenet";
        $pwd = "sirenet";
        $db="(DESCRIPTION=(ADDRESS_LIST=
            (ADDRESS=(PROTOCOL=TCP)
              (HOST=$host)(PORT=$port)
            )
          )
           (CONNECT_DATA=(SERVICE_NAME=$service))
     )";

        if ($test==1){
                $conn = ocilogon($user,$pwd,$db);
        } else {
                $conn = @ocilogon($user,$pwd,$db);
        }
        if ($conn==""){
                $errorCode = 2;
        }
        return $conn;
}

function deconnection($conn){
        ocilogoff($conn);
}
...
?>

------------------------------------------------------------------------

[2004-12-14 18:54:28] damien dot harper at keops dot net

PHP 4.3.10RC2
Oracle 9 database
Oracle 9.2.0.1 client

Everything works fine using command line : php myscript.php gives me
expected results

export ORACLE_SID="ORACLE9"
export ORACLE_HOME="/home/oracle/OraHome1"
export LD_LIBRARY_PATH="/home/oracle/OraHome1/lib"
export TNS_ADMIN="/home/oracle/OraHome1/network/admin/tnsnames.ora"
export NLS_LANG="English_America.WE8ISO8859P1"

here is the script :
<?php
include "queries/fonctionsDb.php";

$username = "sirenet";
$passwd = "sirenet";
$host = "172.16.0.7";
$port = "1521";
$service = "ORACLE9";

//$db="(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=$host)(PORT=$port)))(CONNECT_DATA=(SERVICE_NAME=$service)))";
$db="SIRENET";
$conn = connection();
if (!$conn) {
   echo "Connection failed";
   echo "Error Message: [" . OCIError($conn) . "]";
   exit;
} else {
        echo "Connected!"."\n";

        $parse=OCIParse($conn,"select nom from chevaux");
        OCIExecute($parse,OCI_DEFAULT);
        echo "\nRecuperation de donnees\n";

        $nrows = ocifetchstatement($parse, $rs, 0, 100,OCI_NUM);
                                $resultTab = "";
                                $numCol = 0;
                                for ( $iRow = 0; $iRow < $nrows;
$iRow++ ) {
                                        reset($rs);
                                        while ( $column = each($rs) )
{
                                                 $data =
$column['value'];
                                                
$resultTab[$iRow][$numCol] = $data[$iRow];
                                                echo
$iRow.'|'.$numCol.'|'.$resultTab[$iRow][$numCol];
                                                $numCol++;
                                        }
                                        $numCol = 0;
                                }
        OCIFreeStatement($parse);
deconnection($conn);
}
?>

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/31038

-- 
Edit this bug report at http://bugs.php.net/?id=31038&edit=1

Reply via email to