0

I have a backend system a sort of inventory management. I want to simply download all my inventory to excel sheet. To accomplish this i have used PhpExcel as my system is built with php.

So far everything is working fine (No. of records were around 9 000). But since i have uploaded another 12 000 records into database system is causing issues while generating excel file.

Excel file:

The excel file which gets generated contains multiple worksheet (around 12 maybe). About 3 of then contains > 100k entries. Basically it depends on the number of records.

For example: Records = product & single product contains multiple attributes. So if i have 22 000 products and each product contains 10 attribute then i will have 22 0000 entries in attributes worksheet. As far as i am able to get this issue, i think these 3 worksheet related to attributes is causing issue.

What can I do to prevent this issue?

James Z
  • 12,209
  • 10
  • 24
  • 44
  • 2
    The answer may change based on what the point of failure is: Is it the request/response on the web is the problem (I assume you are generating it on a web page)? If this is the problem the solution may be putting a jobqueue (message queue) and get the report send as an email after generated (instead of request response). If the problem is bloated/unresponsive database, adding proper indexes can help. I suggest finding database logs and rerun the queries with execution details (e.g. if mysql you can run `explain `). – CM. Oct 10 '18 at 07:17
  • Possible duplicate of [PHPExcel runs out of 256, 512 and also 1024MB of RAM](https://stackoverflow.com/questions/4817651/phpexcel-runs-out-of-256-512-and-also-1024mb-of-ram) – Bilal Ahmed Oct 10 '18 at 07:26
  • 1
    Please don't use indian words like "lac". It will be really difficult for non-Indians to understand what "in count of lacs" means. – James Z Oct 10 '18 at 14:37
  • @JamesZ Thanks. I will keep that in mind for future posts. – Anubhav Gupta Oct 11 '18 at 09:10

1 Answers1

1

try changing below configuration in your php.ini file

max_input_vars
max_execution_time
post_max_size

to higher values of your current configuration

Saurabh Sharma
  • 430
  • 2
  • 11
  • Here i am not doing upload. I am trying to download a file. So post_max_size doesn't makes sense to me. – Anubhav Gupta Oct 10 '18 at 12:27
  • @AnubhavGupta you are right I searched it found a good article here https://stackoverflow.com/questions/4895230/why-phpexcel-does-not-allow-to-write-more-than-5000-rows – Saurabh Sharma Oct 10 '18 at 12:36