Wednesday, January 15, 2025

Allowed memory size of 134217728 bytes exhausted (tried to allocate 20971520 bytes) while accessing a page of the site

 Fatal Error: Allowed Memory Size of 134217728 Bytes Exhausted error in my web application, while accessing a page. To solve this issue, we have to do a configuration change in php.ini of our web server.

Follow these steps to update memory limit to resolve this error from the Mac/Ununtu terminal:

  1. Determine PHP version from terminal

RUN: php -v

  1. Navigate to php.ini file

REFERENCE: nano /etc/php/{PHP_VERSION}/php.ini

RUN: nano /etc/php/8.3/php.ini

  1. Use up and down arrows to locate memory storage and update storage allocation (this was surprisingly far down) memory_limit = 128M

Update to 256M

  1. Save and exit php.ini

Ctrl + O to save changes in nano

Enter to save to file

Ctrl + X to exit

This resolved this error for me! Hope this helps

No comments: