How to fix PHP memory Fatal errors allowed memory size in Magento

For .htaccess, go to your Magento installation folder, edit and add the following lines:
Step 4. Add this line of the code right after <?php tag in index.php:
For php.ini, go to /etc/php.ini, edit file and add the following lines:
Quick note: If you have access to FTP or SFTP, you can navigate to the same file location to make changes to files using Filezilla or CuteFTP, Winscp.
Step 5. Click the Save Changes button in the upper right corner of working space:
Step 2. Click on Settings in the top right corner of the working space and navigate to root folders of your Magento Installation.
Step 9. Check if the issue is fixed, if not, you should also change php memory limit in two files: php.ini and .htaccess file
You can set the value more than 768M to ensure that there’s enough PHP memory for handling Magento tasks
That comes to the end of the tutorial. If you have any further questions on this topic, please comment below to let us know.
Step 8. Click the Save Changes button in the upper right corner of working space:

Due to the robust design, unfortunately, Magento may confront with memory intensive issue. The error may be like this PHP Fatal error: Allowed memory size of 45108864 bytes exhausted (tried to allocate 157556 bytes) in path/to/file.php
Users, however, are able to adjust the memory limits in order to solve the memory errors. This tutorial will show you how to fix those errors by adding codes into 2 files separately.
ini_set("memory_limit","768M");
php memory limit magento
Fatal error: Allowed memory size of 4294967296 bytes exhausted (tried to allocate 130968 bytes) in /var/www/magento/app/code/core/Mage/Core/Model/Resource.php on line 199


Step 7. Add the following code to the first line:
Step 3. Go to the index.php file and have a right click. Select Code Edit then click Ok.
Step 1. Login to the Account Management Panel and under your account name, click the cPanel button to be redirected to the cPanel. Then, open File Manager.

After everthing is done, restart your apache to apply changes using:

Step 10. Reload your website to ensure there is no further memory issues exist.
Step 6. Return to the File Manager to go to app/Mage.php file. Right click and select Code Edit as previously.

How to fix PHP memory Fatal errors allowed memory size in Magento
4 (80%) 4 votes