Fix Artisan Command Errors with ‘Allowed memory size .. bytes exhausted’

If you encounter an error resembling the following:

~

If you encounter an error resembling the following:

Fatal error: Allowed memory size of 117647092 bytes exhausted (tried to allocate 14 bytes) in /home/v_102/Laravel/database/connection.php on line 192

PHP has run out of memory while performing Eloquent operations. The biggest cause of this is the query logging that Laravel does behind the scenes. You can either increase memory_limit to a higher amount, however a better solution is to add this line before you start your database queries:

DB::disableQueryLog();

~

Comments