Php running prompt: FatalerrorAllowedmemorysize insufficient memory solution

Source: Internet
Author: User
This article mainly introduces the php running tips: FatalerrorAllowedmemorysize insufficient memory solution. it is a very practical skill to analyze and solve the problems of having server management permissions and having no server management permissions, for more information, see the example in this article. The php running prompt: Fatal error Allowed memory size insufficient memory. Share it with you for your reference. The specific method is as follows:

Some friends may encounter the fatal error: Allowed memory size of 134217728 bytes exhausted error in the newly configured environment or the newly written program. this problem is caused by poor program writing, another problem is that the environment configuration is poor. for example, php5.1.27 + apache2.2.3 seems to have bugs in windows2003. no matter how you fix them, Fatal error Allowed memory size cannot be solved, you can only restart the new environment and php version.

There are many solutions. next we will introduce them to webmasters with different permissions.

1. you can modify the php. ini file with server management permissions.

In php. ini

The code is as follows:

Memory_limit = 8 M;

Increase to 12 MB or larger. (Note: M is not MB)

2. no server management permissions

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

The code is as follows:

Ini_set ('memory _ limit ', '12m'); // you can set it to a larger value.

2. htaccess. this is generally supported by space hosts. create a. htaccess file in the root directory and add the following content:

The code is as follows:

Php_value memory_limit 20000000

Note: In general, 8 m is the standard, but sometimes 8 m is not enough.

Note: Fatal error: Allowed memory size of 8388608 bytes exhausted indicates that the configured memory_limit value is 8 M, and the solution is solved by using the method described above, the memory_limit value must be set to 1.1 points plus debugging successful.

I hope this article will help you with PHP programming.

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.