PHP error Allowed memory size of 67108864 bytes exhausted 3 solutions, 67108864 exhausted
Today, Baidu found a user asking a wordpress installation error when reading php related information, saying that he encountered the following problem when installing the wordpress installation package: Fatal error: allowed memory size of 67108864 bytes exhausted (tried to allocate 76 bytes) in ..... I have never encountered this problem before. According to the prompts, it must be caused by memory overflow. Why is there such a prompt? Next, I will share the error cause and solution I have prepared with phper, hoping to help.
Error cause:
Because the maximum memory consumed by php pages is 8 MB by default (in PHP. ini configuration file), if the file is too large or the image is too large, the above error message will occur during reading.
The solution is as follows:
Solution 1:Add ini_set ("memory_limit", "80 m") to the PHP file. Of course, 80 m can be changed based on your own situation, or not too large. Otherwise, other system resources may encounter problems, -1 is unlimited.
Solution 2:Modify the php. ini configuration file and find
Copy codeThe Code is as follows:; Maximum amount of memory a script may consume (128 MB)
Http://php.net/memory-limit
Memory_limit = 16 M, remove the semicolon, change the value, change memory_limit from 8 M to 16 M (or larger), and restart the apache service.
The third solution is:Modify the. htaccess distributed configuration file (Note: This directory supports. htaccess ). Add a new sentence in the document: php_value memory_limit 16 M (or larger)
Allowed memory size of 67108864 bytes exhausted (tried to allocate 35 bytes)
Allowed memory size of 33554432 bytes exhausted (tried to allocate 7680 problem is the definition of WP_MEMORY_LIMIT is small, but currently the online method is called to change wp-settings
Php memory is insufficient. Allowed memory size of 8388608 bytes exhausted (tried to allocate 1298358 bytes) occurs)
Cause of the error:
It is because the maximum memory consumed by php pages is 8 MB by default (which can be seen in the ini file of PHP). If the file is too large or the image is too large, the above error will occur when reading the file.
Solution:
1. Modify php. ini.
Change memory_limit from 8 M to 16 M (or larger) and restart the apache service.
2. Add ini_set ("memory_limit", "100M") to the PHP file ");
Note: Do not set memory_limit too large to ensure the normal use of other system resources.-1 is not limited.
3. Modify the. htaccess document (provided that the directory supports. htaccess)
Add a new sentence in the document: php_value memory_limit 16 M (or larger)