0

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);
            $stmt->execute();
            $results = $stmt->fetchAll(PDO::FETCH_ASSOC);
            return $results;
        }

conn/db.php

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

odbc.ini

> [iSeries]
Description             = database iSeries 
Driver                  = iSeries Access ODBC Driver
System                  = 192.168.2.3
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 192.168.2.83:5071] 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 thanks

Max DG
  • 19
  • 1
  • Depends on how much memory you have available i would suppose? – GetSet Feb 12 '20 at 17:14
  • If your query result is huge, PHP need to allocate more memory to handle the result. The allocated `memory_limit` is set in `php.ini` file.Try to increase its value (e.g. : 2G) and then restart your web server – Anggara Feb 12 '20 at 17:15
  • Or you could limit your query based on a pagination rule. Like on *timestamp* range for example. – GetSet Feb 12 '20 at 17:16
  • 1
    @Anggara It tried to allocate 4GB. 2GB won't be enough. – gre_gor Feb 12 '20 at 17:16
  • Does this answer your question? [Allowed memory size of 33554432 bytes exhausted (tried to allocate 43148176 bytes) in php](https://stackoverflow.com/questions/415801/allowed-memory-size-of-33554432-bytes-exhausted-tried-to-allocate-43148176-byte) – gre_gor Feb 12 '20 at 17:33
  • I tried ti allocate `memory_limit=-1` in `php.ini` file without results. I think is a timing problem when execute infat in an old version (ubuntu 14, apache2, php2) i worked with `odbc_exec' and it's works fine. how can I increase the response waiting time from the AS server – Max DG Feb 13 '20 at 16:32

0 Answers0