Methods to resolve file size limit exceeded errors _php tips

Source: Internet
Author: User
Tags php script yii

Yesterday encountered a problem, using the YII framework to write PHP script, the DB more than 1 million of the data export, run, successful.

However, when running to No. 490000, the script terminates, prompting the error "File size limit exceeded", so Google, originally a file size exceeded the system limit. The author first reaction, the log file is full??? Quickly view log, incredibly only dozens of k!!! So where is this "big file"?

To start analysis, it is not possible to be a yii framework problem, this is the Linux operating system exception problem and frame without light, nor log file size, carefully look at all the settings log path of the file, are small can be ignored, even if the Yii debug turned off, there are the same problem.

Then change the idea, rerun the script, run the script again, found that dead time is very regular, are in 450,000 records hang, a little more than a lot, began to doubt the process. Decide to view the IO that the script process affects.

1, first get the script process <pid>;

2, use the lsof command to view this PID IO situation: Lsof-p <pid>

Found a suspected file data0/xdebug/cachegrind.out.<pid>, with the execution of the script, the size of this Xdebug file will also increase, and finally, the wish, hang off! At this point the file size is: 2147483647!!

Haha, good familiar figures, 2^31-1!!

It looks like the problem has been found, and as the script executes, Xdebug also writes a log of the script process, which is hung as scheduled when the file size exceeds the file size that the system can support.

OK, turn the xdebug off, run the script again, more than 1 million of the records run smoothly, get it done.

PS: The author uses the server for 32-bit system, and in 32-bit operating system, by the binary, its maximum storage data is 1111111111111111111111111111111.

Because of this, the decimal system embodied in other visual systems is 2147483647.

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.