Home >Backend Development >PHP Problem >Allowed memory size of appears when running php, how to solve it?

Allowed memory size of appears when running php, how to solve it?

autoload
autoloadOriginal
2021-03-15 14:38:569394browse

Error: Allowed size memory of xxx bytes exhausted at xxx:xxx (tried to allocate xxx bytes)

This error message means that if the ini configurationmemory_limit (memory limit) is greater than AG(allocated_memory)

The solution is as follows:

First method: Modify the php.ini configuration file and find the code in php.ini. The code is as follows:

; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = 8M

Remove the semicolon in front and change the value Size, change memory_limit from 8M to 16M (or larger), as follows, and then restart the apache service

Maximum amount of memory a script may consume (128MB)
http://php.net/memory-limit
memory_limit = 256M

The second method: In the PHP file Add the following code:

ini_set(”memory_limit”,”80M”);//大小根据自己的情况改动

Recommended: php video tutorial php tutorial

The above is the detailed content of Allowed memory size of appears when running php, how to solve it?. For more information, please follow other related articles on the PHP Chinese website!

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

Related articles

See more