Today when I was reading PHP related information on Baidu, I found a netizen asked a question about a wordpress installation error. He said that he encountered such a 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. As for why such a prompt appears? Below I will share the error causes and solutions I compiled with PHPer, hoping it will be helpful.
Error reason:
Because the maximum memory consumed by a PHP page is 8M by default (can be seen in PHP's php.ini configuration file), if the file is too large or the image is too large, the above error message will occur when reading.
Solution, I currently know of three solutions:
The first solution is: Add ini_set("memory_limit", "80M") to the PHP file; of course, 80M can be changed according to your own situation, and it should not be too large, otherwise the system will There will be problems with resources, and -1 means no limit.
The second solution is: Modify the php.ini configuration file and find
in php.ini
memory_limit = 16M, remove the semicolon in front, change the value, change memory_limit from 8M to 16M (or larger), and restart the apache service.
The third solution is: Modify the .htaccess distributed configuration file (note: the premise is that the directory supports .htaccess). Add a new sentence in the document: php_value memory_limit 16M (or greater)
Allowed memory size of 33554432 bytes exhausted (tried to allocate 7680 The problem is that the WP_MEMORY_LIMIT definition is too small, but the current method on the Internet is called changing wp-settings
The reason for this error:
is because the maximum memory consumed by the PHP page is 8M by default (can be seen in the PHP ini file). If the file is too large or the image is too large, it will not be read. The above error will occur.
Solution:
1. Modify php.ini
Change the memory_limit from 8M to 16M (or larger), restart the apache service
2. In PHP Add ini_set("memory_limit", "100M");
Note: For the normal use of other resources of the system, please do not set the memory_limit too large, where -1 means no limit
3. Modify the .htaccess document (provided that the directory supports .htaccess)
Add a sentence in the document: php_value memory_limit 16M (or greater)