Questions about memory usage of PHPExcel classes

Source: Internet
Author: User
The PHPExcel class memory usage problem recently helped a company export the background excel function. The tool class is phpexcel, because this class has powerful and comprehensive functions. However, the following problem occurs in [this article comes from Internet of Hong Kong (www.68idc.cn)]: When the exported data volume reaches a certain magnitude, for example, 1000 entries

The PHPExcel class memory usage problem recently helped a company export the background excel function. The tool class is phpexcel, because this class has powerful and comprehensive functions. But encountered [this article from the Internet (http://www.68idc.cn)] the following problem: when the export data volume reached a certain order of magnitude, such as 1000, the server

Memory usage in PHPExcel

Recently, I was helping a company export back-end excel Data Using phpexcel, Which is powerful and comprehensive.

But encountered [this article from the Internet (http://www.68idc.cn)] the following problem:

When the exported data volume reaches a certain order of magnitude, for example, 1000 entries, the server may be stuck or white screen. If you increase the export volume, the 502 error gateway prompt will appear.

After investigation by Baidu and some domestic forums,

The following measures are taken:

1. Set PHP Cache

// Set the cache method PHPExcel_Settings: setCacheStorageMethod ();

2. Set the maximum execution time

// Set the maximum execution time set_time_limit (0 );

But after debugging, it does not work and still reports the 502 error.


Finally, after checking the memory information, I switched the root cause of the problem to the memory, so I made the following settings:

// Set the memory limit ini_set ('memory _ limit ', '256m ');

The following is an exciting result. excel has been exported successfully!

So far, the problem has been solved.

Phpexcel is indeed a powerful class, but it has a lot of room for improvement in performance optimization. I hope to launch a lightweight excel class in the near future. ^_^

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.