Get the App
SLTechnology News&Howtos  ›  Development  › 

How to quickly solve the problem of insufficient php memory

Shulou Source: shulou.com Published: 2022-06-03 07:38:57 10月05日 Update

This article mainly explains "how to quickly solve the problem of insufficient php memory", the explanation content in the article is simple and clear, easy to learn and understand, please follow the ideas of Xiaobian slowly, together to study and learn "how to quickly solve the problem of insufficient php memory"!

Sometimes when we run php again, it will appear

Allowed memory size of 8388608 bytes exhausted (tried to allocate 1298358 bytes)

The reason for this error: to ensure that it is not the cause of the program (such as endless loop), it is due to the default maximum memory consumption of php pages is 8M (you can see it in PHP ini) ,

If the file is too large or the image is too large, the above error will occur when reading.

Solution:

1. Modify php.ini to change memory_limit from 8M to 16M (or greater), restart apache service

2. Add ini_set ('memory_limit','** M') to PHP file; Note: For normal use of other system resources, please do not set memory_limit too large, where-1 is unlimited

3. Modify the.htaccess documentation (if the directory supports.htaccess) by adding the following sentence to the documentation: php_value memory_limit 16M(or greater)

Thank you for reading, the above is "how to quickly solve the problem of insufficient php memory" content, after the study of this article, I believe we have a deeper understanding of how to quickly solve the problem of insufficient php memory, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

Tags: Memory problem insufficient learning content reason file document program error maximum premise method picture that is train of thought situation article time more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft macOS Xiaomi Huawei Shulou Information