PHP Fatal error:  Allowed memory size of 209715200 bytes exhausted (tried to allocate 4294967296 bytes) in /var/www/html .

This can  happen  for various  reasons  like  a loop in your query function  or your column type in mysql table is  longtext or any other kind of data which needs more memory to hold the data while  running query .   To fix this ,

  1. 1. First try to  optimise your query and check for any loop creating functions .
  2. 2. If you are sure that it is not any loop in function then try to increase  memory allocation for PHP by adding  line ini_set(“memory_limit”,”16M“);   in your php script file .
  3. instead you can also add memory limit  in php.ini file  by adding a line  memory_limit=16M which will affect  all php  scripts .
  4. 3. If your my sql column data type is largetext it require 4294967296 bytes (4GB)  memory so instead of increasing memory  can change data type to something like

    MEDIUMTEXT which requires only 16 MB.

  5. You can change existing mysql column data type  with this query 

    ALTER TABLE your_table MODIFY existing_column MEDIUMTEXT;





Leave a Reply

Your email address will not be published.