Okay
Jump to Article Category ... All Categories Proactive - Web Design Agency WordPress Theme (1) Medigo - Medical WordPress Theme (1) Seon - SEO & Digital Marketing WordPress Theme (1) Berich - Business & Consulting WordPress Theme (2) Saira - Digital Agency WordPress Theme (3) Savour - Restaurant WordPress Theme (3) Roofex - Roofing Services WordPress Theme (3) Hardman - Handyman & Plumber WordPress Theme (3) Bisbuzz - Business Consulting WordPress Theme (2) Adsett - Architecture and Interior Design Theme (3) Asri - Multipurpose Business WordPress Theme (3) Chefmaster - Restaurant WordPress Theme (2) Garda - Gardening & Landscaping WordPress Theme (2) Kinco - School Kindergarten WordPress Theme (2) Ecohub - Ecology & Solar Energy WordPress Theme (2) Mindset - Psychology & Counseling WordPress Theme (2) Industo - Industrial Industry & Factory WP (4) Itfirm - Software & IT Solutions WP Theme (6) Grupi - Digital Agency WordPress (6) Organio - Organic Food Store WordPress (6) Gymo - Gym & Fitness WordPress Theme (6) Intime - Business Consulting WordPress (6) Bixol - Cleaning Services WordPress Theme (8) Alico - Insurance Agency WordPress Theme (7) Wam - Creative Agency WordPress (7) Consultio - Consulting & Business WordPress (11) Contio - Construction and Building WordPress Theme (7) Induxe - Factory and Industry WordPress Theme (4) Ovent - Event & Conference WordPress Theme (4) Seolight - SEO & Markting WordPress (4) Murtes - IT Solutions WordPress Theme (4) Onova - IT Solutions and Services Company WordPress Theme (4) Bizkar - Creative Multipurpose WordPress Theme (4) Multio - Multipurpose WordPress Theme (4) Zinco - SEO Marketing Agency WordPress Theme (4) Seomun - Digital Marketing Agency WordPress Theme (4) Archio - Architecture WordPress Theme (4) Lawsight – Lawyer WordPress Theme (4) Romada - Startup Agency WordPress Theme (4) Finano - Finance Consulting WordPress Theme (4) Timan - Dental Clinic & Medical WordPress Theme (4) Nimmo - One Page WordPress Theme (4) Troma - Creative Digital Agency WordPress Theme (4) Limpon - App Landing Page WordPress Theme (4) Unfinity - One page WordPress Theme (1)
  Print

How to Increase the PHP Memory Limit

1. Edit your wp-config.php file

Wp-config.php is one of the most important WordPress files because it contains your base configuration details. You’ll find it in the root of your WordPress file directory.

To edit the memory limit and upload limit, look for this line:

define('WP_MEMORY_LIMIT', '32M');

Modify the second parameter by increasing it. As I mentioned a PHP memory limit of 128M should be more than enough.

define('WP_MEMORY_LIMIT', '128M');

Save the file and you’re done. You may need to increase it again if you’re still getting the fatal error, but don’t go overboard or you may crash your server. All the more reason to reach out to your host for help.

If you’re running into a memory limit fatal error in the admin area of WordPress, then you’ll need to modify a different line in your wp-config.php file.

To increase the WP memory limit for the administration area look for this line and increase it:

define( 'WP_MAX_MEMORY_LIMIT', '256M' );

Admin tasks require more memory, so you’ll need to set it much higher. Double the number you set for WP_Memory_Limit.

2. Edit your PHP.ini file

In the event that modifying your wp-config.php file doesn’t address the problem, you’ll have to address the issue within your server settings instead of within WordPress.

If you’re using shared hosting, you will not be able to access your PHP.ini file, so see the next option instead. If you do have access to PHP.ini, you’ll most likely find it in the root folder, but the location of the file will vary by host.

To increase the PHP memory limit and upload limit, change these lines in PHP.ini

memory_limit = 256M
upload_max_filesize = 12M
post_max_size = 13M
file_uploads = On
max_execution_time = 180

Changing the value of max_execution_time will limit the amount of time for a PHP script to run. If the PHP script exceeds the set value (seconds), it will stop the script and report an error.

In many cases, the values you enter should get larger as you go down the list from lines one to three. The upload_max_filesize should be the smallest while memory_limit should be the largest. The median should be post_max_size.

Before checking to see if the error is gone, clear your browser’s cache.

3. Edit your .htaccess file

If you don’t have access to PHP.ini, then your last resort is to modify your .htaccess file. Your .htaccess file starts with a dot because it is a hidden file. If you don’t see it in your root folder, check to make sure that your SFTP file manager isn’t keeping those files hidden from view.

To increase the PHP memory, you’ll add the following to your .htaccess file:

php_value memory_limit 256M
php_value upload_max_filesize 12M
php_value post_max_size 13M

If the PHP value memory limit has already been set, then increase it.