4

how's it going.

I'm trying to export customers as a CSV file via System > Import/Export > Export, and I just get a blank page as a result.

I select Entity Type of Customers and Export File Format of CSV. When the Entity Attributes table appears I leave it blank and click the Continue button. After a few seconds, blank page. I have made sure that the page has finished loading.

According to Chrome's Developer Tools, Network tab, I'm getting a Server Error (HTTP 500) response but no content. So I'm thinking fatal PHP runtime error. But I don't really know where to go from here. I'm struggling to find the code that's supposed to be running, what with admin controllers being a bit different from frontend ones. And for once, Google's come up empty.

I'm using Magento CE 1.8.1.0 recently upgraded from 1.7.0.2. So have any of you lovely people come across this before and/or know what to do about it?

Thanks!

6

Ah hah!

According to the Apache error log:

PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 84 bytes) in /Zend/Db/Statement/Pdo.php on line 290

So apparently Magento needs over 256MB of memory to export customers. OK the store in question has about 20,000 customers but that still sounds like quite a lot. Plus, this even happens when I filter down to a single surname. My guess is it's not about the size of the generated file (which needn't be held in memory all at once anyway) but that Magento is doing something grossly inefficient at the processing stage (surely not!)

I increased PHP's memory_limit to 512M and problem solved.

I hope this helps some poor wretch in future...

  • Did you ever find another solution. Surely having a memory limit of 512M cannot be a long term answer, in my opinion. – Ebpo Nov 13 '15 at 18:25
  • 1
    Actually I've heard in a couple of forums that 512MB is the minimum recommended amount for running a Magento installation - some suggest 1GB! But then that's not actually so much these days when you think about it... – Doug McLean Nov 13 '15 at 23:52
  • 1
    OK so 512MB is recommended, not minimum: from merch.docs.magento.com/ce/user_guide/magento/… - "memory_limit no less than 256 MB (512 MB recommended)". I never did find an alternative solution, though there are extensions that might do it e.g. gielberkers.com/import-customers-magento-blazing-fast – Doug McLean Nov 16 '15 at 11:32
  • Thanks for the reply ! You are right for the 512 recommended. That will teach me not to read the specs ! – Ebpo Nov 16 '15 at 13:35
2

Make sure that error logging is enabled (Admin Panel > System > Configuration > Developer > Log Settings > Enabled = Yes), then check:

  • var/log/system.log and
  • var/log/exception.log

This'll help pinpoint the cause of the issue, which is the first place you want to start looking. In 9/10 cases you will receive the file name responsible for the fatal error as well as a line number.

Navigate to the aforementioned line number and start backtracing the issue until resolved.

  • Thanks, I did have both of these enabled but they weren't trapping the error. It was the good old Apache log that caught it in the end - I really should remember to check that one more often! – Doug McLean Feb 28 '14 at 11:24
0

So apparently Magento needs over 256MB of memory to export customers. OK the store in question has about 20,000 customers but that still sounds like quite a lot. Plus, this even happens when I filter down to a single surname. My guess is it's not about the size of the generated file (which needn't be held in memory all at once anyway) but that Magento is doing something grossly inefficient at the processing stage (surely not!)

I increased PHP's memory_limit to 512M and problem solved.

Not really though.

What if you have 200k or more rows to export? 512mb will prolly be enough, but max_execution_time of 60s (default) will be an issue.

And if you increase that, depending on the time you set, you could either end up with the same timeout problem, or end up having huge load times (minutes) on a still screen and prolly cause problems elsewhere where request shouldve gone to timeout.

Those are temp fixes, main problem is that export is one request. Better solution is to rewrite that module to make consecutive requests if the number of table entries is large, or to use cron to make such request (but then again you have to notify user somehow that export is finished and ready to be downloaded).

All in all, its a mess (as usual).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.