PHP memory is insufficient.

Source: Internet
Author: User

Sometimes, when we run the PHP program again

Allowed memory size of 8388608 bytes exhausted (tried to allocate 1298358 bytes)

Cause of the error: make sure it is not the cause of the program (such as an endless loop ), because the maximum memory consumed by PHP pages is 8 MB by default (as can be seen in the INI file of PHP ),

If the file is too large or the image is too large, the above error occurs during reading.

Solution:

1. Modify PHP. ini to change memory_limit from 8 m to 16 m (or larger), and restart the apache service.

2. Add ini_set ('memory _ limit ',' ** m') to the PHP file. Note: Do not set memory_limit too large for normal use of other system resources, -1 is not limited

3. Modify the. htaccess document (provided that the directory supports. htaccess). In this document, add the following sentence: php_value memory_limit 16 m (or larger)

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.