Onkar Onkar - 1 year ago 82
PHP Question

Laravel paginate() not working when passed a big number

I want to implement

paginate()
function with 1 lac records. For that I'am using below code:

$user_obj = new User();
$users = $user_obj->paginate(100000);


But this code is not working but it's working when I pass 10 thousand or another number. I've more than 3 lac records in my table. I am using
get()
method to fetch all data the
get()
function is also not working.
The page is not working after executing this code, it's throwing below error



This page isn’t working

localhost didn’t send any data.

ERR_EMPTY_RESPONSE



enter image description here

Answer Source

This error occur due to your request our php max_execution_time or memory_limit so you can set unlimited memory using ini option. Something like this

ini_set('memory_limit', -1);
ini_set('max_execution_time', -1); //-1 is unlimited

But using this option some time may be your server is down due to heavy load so be careful before using it

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download