From:             [EMAIL PROTECTED]
Operating system: windows 2000
PHP version:      4.0.6
PHP Bug Type:     OCI8 related
Bug description:  php.exe application error - cannot 'read' memory address

i'm using php 4.0.6 through IIS5 on a windows 2000 workstation.

this is similar to bug #11202, except it occured to me while i was using
oci8 as apposed to MS SQL (which worked fine for me).

my exact error is 'php.exe - application error:
the instruction at "0x77f83a33" referenced memory at'
"0x00000010". The memory could not be "read".

when i click "OK" to terminate the program, the script seems to complete
it's execution as i want, just with the painful error showing.
if i click on "CANCEL", it's like it's in an endless loop.
btw - i'm trying to connect to an 8i 8.1.6 database.

so i'm not really sure if it's an oci8 problem or whether it's an IIS5 or
windows 2000 problem.

here is a sample script which i am using.

<html>
<title>Default php load file.</title>
<body>
<?php
  include("classes.php");

  // test for MS SQL server. This part works without errors.
  // Create new connection.
  $mssql_conn = new Connection($database_name, $database_type,
$server_name, "webuser", "webuser");

  //test connection with a simple SELECT call.
  $SQL = "SELECT * from role_type ";
  $result = $mssql_conn->exec($SQL);
  echo $result;
  echo "<br>";
  echo mssql_num_rows($result);
  echo "<br>";
  echo "<br>";

  // Test for oracle database..
  // This part produces the error.
  $ora_conn = new connection("PS_PLATO", "ORA", "PLATO", "psadmin",
"d3g3sh");
  $SQL = "SELECT * from advert ";
  $result4 = $ora_conn->exec($SQL);
  echo "result of exec statement " . $result4;
  echo "<br>";
  echo ocinumcols($ora_conn->stmt);
  echo "<br>";
  echo "<br>";
?>

this is the classes.php include file.
<?php

  class Connection
  {
    // Variables
    var $connect_to;
    var $server;
    var $database;
    var $db;
    var $stmt;

    // Constructor
    function Connection($database_name, $database_type, $server_name = "",
$username = "", $password = "", $port="")
    { 
      if ($database_name != "" && $database_type != "")
      {
        $this->connect_to = $database_type;
        $this->server = $server_name;
        $this->database = $database_name;

        switch ($database_type) {
          case "MSSQL":
                $this->db = mssql_connect($server_name, $username, $password);
                if ($this->db <> false) 
                {
                  $done = mssql_select_db($database_name, $this->db);
                }
                break;
          case "ORA":
                $this->db = ocilogon($username, $password, $database_name);
                break;
          case "ODBC":  
                $this->db = odbc_connect($database_name, $username, $password);
                break;
          case "PGSQL":
                $this->db = pg_Connect("host=$server_name port=$port
dbname=$database_name user=$username");
                break;
          default:
                echo "<font face=tahoma>Invalid or Unsupported database
type.</font><br>";
        }
      } else {
        echo "<font face=tahoma>Information missing in connection
string.</font><br>";
      }
    }

    // Functions
    function exec($SQL)
    // for the DML calls to databases.
    {   echo $this->connect_to;
        echo "<bR>";

        switch ($this->connect_to) {
          case "MSSQL":         return mssql_query($SQL, $this->db);    break;
          case "ODBC":          return odbc_exec($this->db, $SQL);      break;
          case "PGSQL":         return pg_exec($this->db, $SQL);        break;
          case "ORA":           $this->stmt = ociparse($this->db, $SQL);
                                return ociexecute($this->stmt);         break;
          default:
                echo "<font face=tahoma>Invalid or Unsupported database
type.</font><br>";
        }
    }
  }
?>

this is meant to be a basic database wrapper - you pass in a database type,
name, server name, username, password and a port number(for those dbases
that need it), and it opens a valid connection to that dbase. then you can
perform standard commands like the execution of an sql statements and the
standard php-database funcitons like num_rows etc.

refreshing the pages does little more than represent the error to the
screen.
-- 
Edit bug report at: http://bugs.php.net/?id=12077&edit=1


-- 
PHP Development 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