|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2004-06-25 16:56 UTC] ben at grinvalds dot net
 Description:
------------
I have been testing my code in PHP5 and have been getting regular Apache.exe Application errors.
When I run the script below a few times, I will consistantly get reference memory errors.  Even after I re-boot my system.  My application makes many calls to an Oracle database.  I'm not sure if this is specifically related to OCI or if it is a more general PHP memory issue.
Environment:
  OS: Windows XP Professional with SP1
  Server: Apache 1.3.31 (Win32)
  DB: Oracle 8.4.7  
Reproduce code:
---------------
<?php
  $conn = oci_connect("scott", "tiger", "your_host_name");
  for ($p=0; $p <= 500; $p++) {
    $stmt = oci_parse($conn, "select ENAME from emp");
    oci_execute($stmt);
    $i = 0;
    while (oci_fetch($stmt)) {
      $i++;
      $name = oci_result($stmt, "ENAME");
      echo $name . "<br>";
    }
    echo "<br>";
    echo $i . " Records Selected. Count:" . $p;
    echo "<br><br>";
  }
  oci_free_statement($stmt);
  oci_close($conn);
?> 
Expected result:
----------------
I should be able to run this without encountering any Apache.exe Application error.
Actual result:
--------------
The error message that I am receiving is: The instruction at "0x6042fdc2" refereced memory at "0x00000010". The memory could not be "read".
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 23:00:01 2025 UTC | 
I have included a script which causes a reference memory error to occur more frequently. If you run this script three or four times back to back you will get the error. Ben <?php class Test { var $_results; var $_ncount; function display() { $conn = oci_connect("scott", "tiger", "host_name"); $stmt = oci_parse($conn, "select ENAME from emp"); oci_execute($stmt); $this->_ncount = oci_fetch_all($stmt, $this->_results); oci_free_statement($stmt); oci_close($conn); for ($i = 0; $i < $this->_ncount; $i++) { echo $this->_results["ENAME"][$i]; }}} $test = new Test(); $test->display(); ?>I went and got the latest version PHP 5.0.1-dev (cli). I ran the following script from the console and it consistantly hung the php execution. This is how I executed it at the command prompt (> php.exe -f test.php). Here is the script I ran. The object count for my database was just over 10,000 records. <?php $conn = oci_connect("scott", "tiger", "yourhost"); $stmt = oci_parse($conn, "select * from all_objects where owner = 'SYS'"); oci_execute($stmt); $count = 0; while ($row = oci_fetch_assoc($stmt)) echo $count++ . " "; oci_free_statement($stmt); oci_close($conn); echo "Executed Query"; ?>