Allowed memory size of appears when running php, how to solve it?

autoload
Release: 2023-03-08 18:04:01
Original
9310 people have browsed it

Error:Allowed size memory of xxx bytes exhausted at xxx:xxx (tried to allocate xxx bytes)

This error message means that if the ini configurationmemory_limit(memory limit) is greater thanAG(allocated_memory)

The solution is as follows:

First method: Modify thephp.iniconfiguration file and find the code inphp.ini. The code is as follows:

; Maximum amount of memory a script may consume (128MB) ; http://php.net/memory-limit memory_limit = 8M
Copy after login

Remove the semicolon in front and change the value Size, changememory_limitfrom 8M to 16M (or larger), as follows, and then restart the apache service

Maximum amount of memory a script may consume (128MB) http://php.net/memory-limit memory_limit = 256M
Copy after login

The second method: In the PHP file Add the following code:

ini_set(”memory_limit”,”80M”);//大小根据自己的情况改动
Copy after login

Recommended:php video tutorialphp tutorial

The above is the detailed content of Allowed memory size of appears when running php, how to solve it?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
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
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!