If you have seen an error like ”Fatal Error: PHP Allowed Memory Size Exhausted” in webserver logs or your browser, this means that PHP has exhausted the maximum memory limit. This tutorial will show two different ways on how you can increase the php memory limit.
Check PHP Memory Limit
You can check by creating a file called info.php in /var/www/html/ with the following content:
Increase PHP Memory Limit
Method 1. Changing memory limit from php.ini
First find locate the php.ini file used by your web server.
Search “memory_limit” in your php.ini, and change it. If no “memory_limit” found, add the following line at the end of php.ini
#memory_limit = 64M ;Maximum amount of memory a script may consume (64MB)
#service httpd restart
#service nginx restart
Find the “.htaccess” in your root directory of the specified domain, edit the .htaccess file in the web root directory. Look for the section:
#php_value memory_limit 64M ;Maximum amount of memory a script may consume (64MB)
Congratulation’s! You have successfully increase PHP memory limit. Thanks for using this tutorial for increase PHP memory limit linux system. For additional help or useful information, we recommend you to check the official PHP web site.