Home >Backend Development >PHP Problem >Allowed memory size of appears when running php, how to solve it?
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!