Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of large memory consumption in php

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces how to solve php memory consumption, the content is very detailed, interested friends can refer to reference, hope to help everyone.

php eat memory solution: 1, change memory_limit from 8M to 16M;2, add "ini_set("memory_limit","100M");";3, modify the.htaccess document.

Operating environment: Windows 7 system, PHP7.4 version, DELL G3 computer

How does php eat memory?

Php page consumes too much memory processing method

This is because the maximum memory consumed by php pages is 8 MB by default (as can be seen in PHP ini files) , and errors occur when reading files that are too large or images that are too large.

Solution:

1, modify php.ini

Change memory_limit from 8 MB to 16 MB (or greater) and restart apache service

2. Add ini_set("memory_limit","100M") 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 file (provided that the directory supports.htaccess)

Add a sentence to the document: php_value memory_limit 16M(or greater)

About php memory consumption how to solve the problem to share here, I hope the above content can be of some help to everyone, you can learn more knowledge. If you think the article is good, you can share it so that more people can see it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report