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’);