Home >Backend Development >PHP Tutorial >How to solve the problem that the php page consumes too much memory
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 |