How To Increase PHP Memory Limit

r00t April 10, 2014

php-logo

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:

 php-memory-limit

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

Restart webserver
Method 2. Changing memory limit using .htaccess

Find the “.htaccess” in your root directory of the specified domain, edit the .htaccess file in the web root directory. Look for the section:

 

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.

PHP Install Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “PHP and Webserver” installation, starting from $25 (Paypal payment). Please contact us to get a best deal!
Share on Google+0Share on Facebook6Tweet about this on TwitterShare on Tumblr0Share on StumbleUpon10Share on Reddit1Pin on Pinterest3
The Tags:

Leave a Comment