Site icon MageComp Blog

Fixed: PHP Fatal Error “Allowed Memory Size” in Magento 2

Hello Magento Friends,

Today I will be providing the solution to resolve PHP Fatal Error “Allowed Memory Size” in Magento 2.

When you install an extension or theme to your Magento 2 store, you may come across below PHP Fatal Error:

“Fatal error: Allowed memory size of 134217728 bytes exhausted”

This is because the PHP process uses larger RAM resources compared to the “memory_limit” specified in the php.ini file.

Let’s find out the solution for PHP Fatal Error “Allowed Memory Size” in Magento 2

Steps to Fix PHP Fatal Error “Allowed Memory Size” in Magento 2:

Step 1:  First, you need to locate the directory of the php.ini directory. This will usually be  

/etc/php/version(ex. 7.4)/apache2

Step 2: Next, find the line “memory_limt =”

Step 3: Finally, you can adjust the value accordingly and save it

Step 4: After modifying the php.ini file you need to restart your apache server. Use the below command

systemctl restart apache2

Conclusion:

This way you can easily solve the PHP Fatal Error “Allowed Memory Size” in Magento 2. Also, look at the below article in case you face the error

Solved: PHP Fatal Error “Call to Undefined Function str_contains()” After Upgrading to Magento 2.4.x

In case you are unable to get rid of the error, let me know through the comment section. 

Happy Reading!

Exit mobile version