Magento 1.8 bug: Memory limit has been reached

I am running Magento CE 1.8 for a big store with the number of products running into few thousands. The site is on test server where everything is running absolutely fine. After so much hard work into it, we are ready to launch it. How exciting!

In theory nothing should go wrong because everything is fine at least on the test server, and I am moving the exact same copy of files and database.

After all the files moved and necessary configuration changes made on the database, I decide to make the final check on the temp URL, just to make sure. And as a normal practice I login to the backend and clear all the Cache.

Then all the hell break loose!

There is a series of problems:

  • None of the product images are displaying on Frontend, though I can see them on Backend, as well as on /media/catalog/product folder.
  • Cannot upload product images. “Memory limit has been reached”, comes the error in red.
  • On WYSIWYG editor Media Storage, image thumbnails will not show.
Memory limit has been reached : (

Memory limit has been reached : (

media_storage

Broken thumbnail links on WYSIWYG Media Storage

After hours of Googling and pulling out my hair (which incidentally has started to go grey), I realised that it is Magento bug.

Culprit:

There is a file called Gd2.php in the folder lib/Varien/Image/Adapter

There is a function called _convertToByte() which checks for php_memory limit. The function checks whether the size is given in M or KB and converts to bytes accordingly. The bug is, it does not check if the size is given in GB. So if you are going through above same problems, apparently your server has php_memory limit given in GB.

Solution:

I know it is a bad idea to hack core files. But for now at least I am in some nirvana! Here is the solution (PHP memory limit set as 2G):

Hope this helps someone!

Note: As I have mentioned above, hacking into core files is not at all advisable. Apparently there is a way to change PHP memory configuration on your website host via WHM (please read comment from Daniel Radman). If you do not have access to WHM, get in touch with your hosting company.

Update (22 Jul 2014):
On yet another host, the above solution did not completely solve the issue. This time on Backend when I tried to generate PDF invoices it threw an error that said “JPG support is not configured properly”. 

JPG support is not configured properly

JPG support is not configured properly

This was because the host server did not have “JPEG Support” enabled on PHP GD component. This meant that JPG images were not getting cached on product list and view pages, plus it caused the above issue while trying to generate PDF invoices.

Contact your host to enable GD support for JPEG (plus other image formats like GIF and PNG if thay are not enabled too).

This is how your phpinfo() should look like on GD component:

JPEG support should be enabled on GD

JPEG support should be enabled on GD

About me

profileSangay Tenzin
Web Developer, Magento, Concrete5, Wordpress, Shopify, Ecommerce, Website all-rounder, Casual blogger…

Love… Happiness…

About me

profileSangay Tenzin
Web Developer, Magento, Concrete5, Wordpress, Shopify, Ecommerce, Website all-rounder, Casual blogger…

Love… Happiness…

Category
Archive
Download

Downloads

Bhutanese Calendar
གནམ་ལོ་ ས་ཕོ་ཁྱི་ལོ།

Earth Male Dog Year 2018

འབྲུག་ཟླ་ གསུམ་པ - བཞི་པ།

May 2018

ཟླ་བ Sun
མིག་དམར Mon
ལྷག་པ Tue
ཕུར་བུ Wed
པ་སངས Thu
སྤེན་པ Fri
ཉི་མ Sat
 
 
༡༦ 1
༡༧ 2
༡༨ 3
༡༩ 4
༢༠ 5
༢༡ 6
༢༢ 7
༢༣ 8
༢༤ 9
༢༥ 10
༢༦ 11
༢༧ 12
༢༨ 13
༢༩ 14
༣༠ 15
16
17
18
19
20
21
22
23
༡༠ 24
༡༡ 25
༡༢ 26
༡༣ 27
༡༤ 28
༡༥ 29
༡༦ 30
༡༧ 31

Powered by Bhutanese Calendar