3 ways to modify PHP's memory_limit limit_PHP tutorial

WBOY
Release: 2016-07-13 10:43:27
Original
1241 people have browsed it

memory_limit is an important parameter in php.ini. It can limit the maximum memory usage of your php. If it is too small, it will cause a Fatal Error when running: Allowed memory size of xxxxxx bytes exhausted error. Let’s take a look at the solution below.


Edit php.ini In php.ini, find the "memory_limit" item. 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

Save file

Restart the php web server. If the web server uses Apache, execute:

httpd restart

You may not be allowed to modify php.ini privately. Then, you may want to consider other methods to increase the value of memory_limit.

Method 2 to modify memory_limit size: .htAccess

Note: This method only takes effect when php is executed with the Apache module. Find the ".htaccess" file in the root directory of your website. If you don't have one, you can create one yourself. Then put the following configuration into it

php_value memory_limit 128M; You can change 128M to any value you want to set

Method 3 to modify the memory_limit size: Modify the memory settings of php during runtime

Just add the following command line to your php code.

ini_set(‘memory_limit’,’128M’);

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/633174.htmlTechArticlememory_limit is a more important parameter in php.ini. It can limit the maximum memory usage of your php If it is too small, a Fatal Error will be prompted at runtime: Allowed memo...
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