How to solve the problem that the php page consumes too much memory

WBOY
Release: 2016-07-25 09:00:50
Original
1168 people have browsed it
Sometimes the memory consumed by the PHP page is abnormally large, which means it is too large. How to solve it? This article provides a simple and effective solution for your reference.

Cause analysis: The maximum memory consumed by a php page (configured in php.ini) is 8M by default. If the files or images operated by php are too large, an exception will occur.

Programmer Home recommends a solution for everyone: 1. Modify php.ini Change memory_limit from 8M to 16M (or larger), and then restart apache.

2. Add ini_set("memory_limit", "100M"); in the PHP file. Note: For the normal use of other resources of the system, do not set memory_limit too large, where -1 means no limit.

3. Modify the .htaccess document (the current directory needs to support .htaccess) Added to the documentation: php_value memory_limit 16M //The value can be adjusted to a suitable range as needed



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