Home  >  Article  >  Backend Development  >  ThinkPHP prompts the error Fatal error: Allowed size memory solution, thinkphpfatal_PHP tutorial

ThinkPHP prompts the error Fatal error: Allowed size memory solution, thinkphpfatal_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:07:001138browse

ThinkPHP prompts the solution to the error Fatal error: Allowed memory size, thinkphpfatal

The example in this article describes the solution to the error Fatal error: Allowed memory size prompted by ThinkPHP. Share it with everyone for your reference. The specific analysis is as follows:

If your ThinkPHP prompts you: Fatal error (Fatal error: Allowed memory size), according to what is said on the Internet, increasing the memory that the server can use is not a good solution. There's no need to bother. Because this is a BUG in ThinkPHP itself.

Error message: Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 523800 bytes) in /var/www/www.example.com/ThinkPHP/Lib/Template/ ThinkTemplate.class.php on line 265.

If your error message is the same as mine, it also tells you that there is an error in the file ThinkTemplate.class.php, that is, it has an infinite loop when parsing its own tag include or other tags, causing the server to have insufficient memory. Used for recycling.

Solution:

1. Find the source of the problem. In the template page where the error (Fatal error: Allowed memory size) occurs, find the ThinkPHP tags you used (include/if/empty, etc.), delete the test one by one to see which tag is causing it;

2. Replace the tags you use with native PHP, such as:

Copy the code The code is as follows:



include './Public/home/js/Company/companyJS.html';

If it is because of empty, you can refer to the above:

Copy code The code is as follows:

if(empty($a)){
echo 'a is empty'
}

This problem is solved!

I hope this article will be helpful to everyone’s programming based on the ThinkPHP framework.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/957133.htmlTechArticleThinkPHP prompts the error Fatal error: Allowed memory size solution, thinkphpfatal This article describes the example of ThinkPHP prompting the error Fatal error: Solution to Allowed memory size. Share to...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn