PHP Run tips: Fatal error allowed memory size of the solution to the lack of memory _php tips

Source: Internet
Author: User

This example describes the PHP run Tip: Fatal error allowed memory size memory solution. Share to everyone for your reference. The specific methods are as follows:

Some friends a newly configured environment or a newly-written program of your own will run into the fatal error:allowed memory size of 134217728 bytes exhausted error, a problem that is poorly written, Another is that the environment configuration is not good will appear, like php5.1.27+apache2.2.3 in the windows2003 will appear in the bug no matter how you fix it can not solve the fatal error allowed memory size This problem, You can only configure the new environment and PHP version in the reboot.

There are many solutions, the following we will be based on different permissions of the webmaster to introduce.

First, you can modify the php.ini file for server administrative rights

Can be directly in the php.ini

Copy Code code as follows:
Memory_limit = 8M;
Increase to 12M or greater. (Note: The following m is not MB)

Second, for no server administrative permissions

1.php directly modify memory but you need PHP to support the Ini_set function, this method will not work if the function is prohibited in php.ini.

Copy Code code as follows:
Ini_set (' Memory_limit ', ' 12M ');//can certainly be set to a larger value

2.htaccess Way, this general space host is supported, in the root directory to establish the. htaccess file, add the following:

Copy Code code as follows:
<filesmatch ". (php|html?) $ ">

Php_value Memory_limit 20000000

</FilesMatch>

Note: Generally speaking, 8M is the standard, but sometimes 8M is not enough.

Special reminder: Fatal error:allowed memory size of 8388608 bytes exhausted, which indicates that the configured Memory_limit value is 8M, is also resolved using the method described above, Memory_ Limit value to 1.1 points plus debugging success.

I hope this article will help you with your PHP program design.

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.