Image Resizing Kills Pages?

Running MVE 4.02 with 450 vendors, 6K or so products.

Our error logs are filled with this kind of error:

mod_fcgid: stderr: PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 5372 bytes) in /var/www/vhosts/ on line 605

The relevant lines in the function seem to be associated with the image resizing routine and jpeg creation. It seems like the processor regularly chokes on some of our images.

We've limited out upload file size to 2MB, but still find that images that vendors upload can images that decompress to enormous sizes that still choke the server while generating thumbnails (a 150k jpeg can easily decompress to 20+MB) and then the process times out and customer gets a blank page.

Why CS-Cart kills the whole page rather than just the one thumbnail is unclear.

Generally this error is then followed by:

[Wed Oct 01 10:33:23 2014] [warn] [client] mod_fcgid: read data timeout in 45 seconds, referer:
[Wed Oct 01 10:33:23 2014] [error] [client] Premature end of script headers: index.php, referer:

Occasionally we can track down an oversize image, resize it and reupload, but as vendors are constantly revising products, it's a fools errand. And the errors aren't called consistently - sometimes the page will die, sometimes it won't. We see it on both category search results and product pages.

We've contemplated implementing some sort of pre-processing routine on upload that resizes all images to a known pixel dimension size and recompresses them consistently before storing as the master image, but want to be sure we aren't misssing something in our diagnosis of the problem…

Could a server config issue cause this? 45 seconds seems like a long timeout.


Please try increasing the value of the memory_limit variable. In your config.local.php file, find the following line of code:

@ini_set('memory_limit', '256M');

and replace it with this one:

@ini_set('memory_limit', '512M');

You will also need to increase the master value of this variable in your server configuration. I hope this will help.

Please contact your hosting administrator and ask him to configure the mod_fcgid (increase timeout value in the fcgid.conf file, etc).

i have the same problem what the reason for it host config or image size