Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Allowed memory size of 134217728 bytes exhausted (tried to allocate 42 bytes) [closed]

Tags:

loops

php

mysql

I am retrieving record from mysql table which return more than 0.2m number of rows per query, which obviously take lot of memory. in my case i have 8 GBs installed RAM on my system with SSD 256 GBs. When i execute my page it returns the following error:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 42 bytes) in D:\xampp\htdocs\classes\CRUD.php on line 84   

I think i should need to use threading instead of php loops over table rows? Maybe i am wrong. Any suggestion/help will be appreciated.

like image 201
Abdul Rahman Avatar asked May 03 '16 08:05

Abdul Rahman


1 Answers

Default php.ini memory_limit is 128 MB. You should either:

  • Optimize your code to use a normal amount of data
  • change memory_limit in php.ini to higher value which I do not recommend at all - with your approach you will hit this wall once again
like image 188
Maciej Asembler Avatar answered Oct 13 '22 00:10

Maciej Asembler