Out of memory (50855936 allocated) (tried to allocate 50331646 bytes)

I have this query:

$start = 0;
$number_of_posts = 10;

 $sql = $db -> prepare("
            SELECT  U.username, U.offer_photo, F.activities, A.id_offer, A.offer, A.role, A.content, A.date_post, A.limit, B.type_offer, C.local  
            FROM  type_offer B, local C, offer A
            INNER JOIN users U
            ON U.id_user = A.company_users_id_user1
            INNER JOIN company F
            ON F.users_id_user = A.company_users_id_user1   
            WHERE state = 0 
            AND
            A.type_offer_id_type_offer = B.id_type_offer 
            AND
            A.local_id_local = C.id_local
            ORDER BY date_post 
            DESC LIMIT ?, ?
            ");
        $sql -> bind_param('ii',$start, $number_of_posts);
        $sql -> execute();
        $sql -> bind_result($username, $offer_photo, $actividades, $id_oferta, $oferta, $cargo, $conteudo, $data_post, $data_limite, $tipo_oferta, $local); //problem here
            $sql->fetch();
            $sql-close;

And I have memory_limit: 256Min phpinfo (); However, I still have a memory problem. I already tried this code without success:

set_time_limit(0);
ini_set('memory_limit', '2000M');

So my question is: is it possible to optimize a query or how to increase memory? I do not have access to php.ini, but I think that 256 MB should be enough, so maybe the problem is in the request.

+1
source share
1 answer

Is u.offer_photo a blob field? If so, I would suggest rewriting the logic so that you do not retrieve the blob data until you display it.

, , , , , , .

+1

All Articles