Quick workaround for PHP memory not available _php tutorial

Source: Internet
Author: User
Sometimes when we run the PHP program again, it appears

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

The reason for this error: In order to ensure that it is not the cause of the program (such as a dead loop), is due to PHP page consumption of the maximum memory default is 8M (can be seen in the PHP INI),

This error occurs if the file is too large or the picture is too large to read.

Workaround:

1. Modify the php.ini to change the memory_limit from 8M to 16M (or larger) and restart the Apache service

2. Add Ini_set (' Memory_limit ', ' **m ') to the PHP file; Note: For the normal use of other resources of the system please do not set the memory_limit too large, where 1 is unlimited

3. Modify the. htaccess document (provided that the directory supports. htaccess) Add a new sentence to the document: Php_value Memory_limit 16M (or larger)

http://www.bkjia.com/PHPjc/824931.html www.bkjia.com true http://www.bkjia.com/PHPjc/824931.html techarticle Sometimes when we run the PHP program again, the allowed memory size of 8388608 bytes exhausted (tried to allocate 1298358 bytes) occurs because of this error: in ensuring that the program is not producing ...

  • 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.