About the Phpexcel class consuming memory issues

Source: Internet
Author: User

Recently in helping a company to do the background Excel export function, the use of the tool class is phpexcel, because this kind of function is more powerful, comprehensive.

However, you encounter one of the following problems:

When the amount of data exported to a certain number of times, such as 1000, the server is stuck, white screen phenomenon, if you increase the number of exports, there is a 502 error gateway hint.

After Baidu, some domestic forum for the investigation,

The following measures are drawn:

1. Set the PHP cache

//Set Caching method Phpexcel_settings::setcachestoragemethod ();

2. Set Maximum execution time

// set maximum execution time Set_time_limit (0);

However, after debugging, it did not work, still reported 502 errors.


Finally, after looking at the memory information, I turned the problem source recovery into memory, so I made the following settings:

// Setting Memory Limits Ini_set (' Memory_limit ', ' 256M ');

Next is the excitement of the result, Excel successfully exported!

At this point, the problem has been resolved.

Phpexcel is a powerful class, but there is a lot of room for improvement in performance optimization, and hopefully in the near future a lightweight Excel usage class can be introduced ^_^

About the Phpexcel class consuming memory issues

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.