Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) Laravel
This means you need to also update your php.ini memory_limit
directive.
Try put in your php.ini :
memory_limit=1024M and restart apache :
sudo systemctl restart httpd.service
Change in php.ini
which is there inside apache2
folder
memory_limit=1024M
restart apache2
you can even check which php ini config is using by:
php -i | grep "php.ini"
This problem occurs when an application uses more memory than PHP allows. thanks to PHP's relatively conservative default memory settings. you can fix this issue by change memory_limit size in your php.ini
memory_limit= Replace your size(1024M /2048M/etc) change and save it, then restart the services.
In Windows, you can find "C:\wamp64\bin\php\php_version\php.ini" then restart your service.
In Ubuntu, you can find "/etc/php/php_version/apache2/php.ini" then run
sudo systemctl restart apache2
for restart apache.
You can simply increase the memory limit programmatically early on in your code, before your process runs out of memory. If you do it this way, you can give PHP extra memory only when that piece of code gets called rather than increasing the memory limit for all PHP processes.
ini_set('memory_limit', '1024M');