3 solutions to the PHP error Allowed memory size of 67108864 bytes exhausted, 67108864exhausted_PHP tutorial

WBOY
Release: 2016-07-13 10:22:09
Original
1446 people have browsed it

3 solutions to the PHP error Allowed memory size of 67108864 bytes exhausted, 67108864exhausted

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

Copy code The code is as follows:
; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit

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 67108864 bytes exhausted (tried to allocate 35 bytes)

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

php memory is not enough, Allowed memory size of 8388608 bytes exhausted (tried to allocate 1298358 bytes) appears

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)

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/851342.htmlTechArticle3 solutions to the PHP error Allowed memory size of 67108864 bytes exhausted, 67108864exhausted Today I learned about php related information on Baidu I found a netizen asking about WordPress installation tips...
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!