Magento CSV Export – Fixing Customer CSV Export Fails with Blank Page

ce-1.8.1.0csvcustomerexport

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!

Best Answer

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...

Related Topic