Home » Php » odbc – php allocate some memory

odbc – php allocate some memory

Posted by: admin February 25, 2020 Leave a comment


Hy i have a proble with a simple function

function gettable($ART, $OP, $CONTO){
            include  ('../conn/db.php');
            $sql = "SELECT T1.field1, T3.field2, T1.field3, T1.field4, T1.field5, T1.field6, T1.field7, T1.field8, T1.field9, T1.field10 FROM ";
            $sql .="(SELECT T3.field11, T3.field12, T3.field2 FROM FILE3 T3 WHERE T3.field12 = :art) AS T3 right JOIN "; 
            $sql .="(SELECT T4.field13, T4.field14, T4.field3, T4.field6, T4.field7, T6.field8, T6.field15, T6.field16, T6.field17, T4.field9, T4.field10, T5.field18, T5.field4, T5.field5, T4.field19, T4.field20 ";
            $sql .="FROM FILE4 T4, FILE5 T5, FILE6 T6 WHERE ((T4.field3 = T5.field18) and (T4.field3 = T6.field21))) AS T1 ON T1.field3 = T3.field11 WHERE T1.field13 = :nOP AND T1.field15 = :conto  AND T1.field16='888' AND T1.field17='M' ";     
            $stmt = $pdoConnection->prepare($sql);                   
            $stmt->bindValue(':art', $ART);
            $stmt->bindValue(':nOP', $OP);
            $stmt->bindValue(':conto', $CONTO);
            $results = $stmt->fetchAll(PDO::FETCH_ASSOC);
            return $results;


      $pdoConnection = new PDO("odbc:iSeries") ;


> [iSeries]
Description             = database iSeries 
Driver                  = iSeries Access ODBC Driver
System                  =
UserID                  = myuser
Password                = mypass
Naming                  = 0
DefaultLibraries        = mylib
Database                =
CommitMode              = 2
ConnectionType          = 1
BlockFetch              = 1
BlockSizeKB             = 512

on debug code stops at this line

    $results = $stmt->fetchAll(PDO::FETCH_ASSOC);

this is apache2 log

[Wed Feb 12 16:40:40.749093 2020] [:error] [pid 9641] [client] PHP Fatal error:  Allowed memory size of 838860800 bytes exhausted (tried to allocate 4294967296 bytes) in /var/www/html/.......

is the first time that i have this error (why the function tried to allocate some memory?)
apache2 run on ubuntu 18.04 with php5.6

How to&Answers: