Home > Backend Development > PHP Tutorial > php Allowed memory size of 8388608 bytes exhausted (tried to_PHP教程

php Allowed memory size of 8388608 bytes exhausted (tried to_PHP教程

WBOY
Release: 2016-07-13 10:55:38
Original
1323 people have browsed it

Today, when using a php product, an Allowed memory size of 8388608 bytes exhausted (tried to allocate 46080 bytes) in.... prompt message appeared. After verification, it was because this product did not take user memory into account. Below we Let’s take a look at how to solve this method

It is caused by the parameter memory_limit in php.ini. Because it is not set sufficiently, it causes the above problem. Let’s take a look at several solutions


Method 1, use program to implement

Just add the following command line to your php code

 代码如下 复制代码
ini_set('memory_limit','128M');

This requires that your server has not prohibited modification, and ordinary virtual spaces cannot be operated.

Method 2, use .htaccess, this is very feasible.

Add

to your .htaccess
 代码如下 复制代码
php_value memory_limit 128M ;

You can change 128M to any value you want to set.

Method three, this is for friends with server management rights, directly modify the php.ini file.

Find the item "memory_limit". If not, you can add this parameter yourself at the end of the file. Here are some setup examples

 代码如下 复制代码
memory_limit = 128M ;

You can change 128M to any value you want to set
Just restart apache.

In this way, when I run the product again, the Allowed memory size of 8388608 bytes exhausted (tried to allocate 46080 bytes) in.... mentioned earlier will not appear.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632229.htmlTechArticleToday when using a php product, Allowed memory size of 8388608 bytes exhausted (tried to allocate 46080 bytes) in appeared. .... Prompt message, after verification, it is because this product does not take into account the use of...
Related labels:
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