PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 17295719 bytes) in

created at 10-21-2021 views: 4

The data to be output by php or the data to be queried is too large, and the following errors may be reported

PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 17295719 bytes) in

php view shows the memory_limit memory size

php -r "echo ini_get('memory_limit');"

Solution

1. Permanently modify php memory limit

The number of memory_limit set in the php.ini file is too large, you can change it to a larger value, or directly memory_limit=-1, which means no limit

2. Temporarily modify the memory_limit in the running file

ini_set("memory_limit", "-1");
ini_set("memory_limit", "3072M");
created at:10-21-2021
edited at: 10-21-2021: