Saffarazzi
  • HOME
  • Recipes
  • NEWS
    • Tech
    • Crypto
  • MOTORING
  • LIFESTYLE
    • ENTERTAINMENT
    • Viral
    • Horoscopes
  • LOTTO
    • Daily Lotto
    • Lotto and Lotto Plus
    • Powerball and Powerball Plus
    • UK Lottery Results
      • Thunderball
      • Lotto UK
      • EuroMillions
      • Set For Life
  • MORE
    • About Us
    • Contact Us
    • Write for us!
    • Newsletters and Notifications
    • SPORT
      • Soccer
      • Rugby
      • Cricket
      • Motorsport
  • Privacy
No Result
View All Result
  • HOME
  • Recipes
  • NEWS
    • Tech
    • Crypto
  • MOTORING
  • LIFESTYLE
    • ENTERTAINMENT
    • Viral
    • Horoscopes
  • LOTTO
    • Daily Lotto
    • Lotto and Lotto Plus
    • Powerball and Powerball Plus
    • UK Lottery Results
      • Thunderball
      • Lotto UK
      • EuroMillions
      • Set For Life
  • MORE
    • About Us
    • Contact Us
    • Write for us!
    • Newsletters and Notifications
    • SPORT
      • Soccer
      • Rugby
      • Cricket
      • Motorsport
No Result
View All Result
Saffarazzi
No Result
View All Result
Home Lifestyle

How to Increase the Memory Limit for WordPress

If you need help to increase the Wordpress memory limit on your website then this guide is for you.

Jamie Rautenbach by Jamie Rautenbach
2021-10-29 11:13
in Lifestyle, News
How to increase wordpress memory limit.

How to increase wordpress memory limit.

FacebookTwitterWhatsappLinkedin
ADVERTISEMENT

This guide will teach you how to increase the WordPress memory limit, the upload max size, the post maximum size, the maximum execution time, and the PHP max input vars. Step-by-step instructions so you can do it yourself.

You’re trying to upload your new favourite premium theme demo content to kick start a project or perhaps you’re trying to run a server heavy plugin like wpimportall and suddenly everything stops working and you get the confusing “allowed memory size exhausted” error?

Chances are you’re site has not been optimized for this kind of hard work. The standard WordPress setup is pretty basic and needs tweaking to really perform. Increasing your wordpress memory limit is crucial. So, lets get it done!

What does the error “WordPress memory exhausted” actually mean?

WordPress memory exhausted is simple English and it does in fact mean what you could guess, WordPress has run out of memory and can no longer perform certain tasks. WordPress Memory Limit refers to the max amount of memory that the website is allowed or able to use .Server admins are responsible for ensuring enough memory is allocated to the various applications. Rule of thumb, the bigger and more complex your site the more memory it will need.

ADVERTISEMENT

A web server is essentially like any other computer. It has processors, storage devices and memory (RAM) and just like a computer these elements determine how capable your server is.

PHP, the most popular server side scripting language (were talking over 75% of the web), is foundational in the creation of WordPress, as well as the other 9 top 10 content management systems such as Joomla, Drupal and OpenCart to name only a few. WordPress is a software package which is run on your server and if your server is not appropriately strong it won’t work properly or not at all.

Some of these instructions recommend you edit core WordPress files such as the functions.php file – Make sure you employ a child theme for this or else you may lose your edits at the next update or worse, break your site.

Table of contents

  • What does the error “WordPress memory exhausted” actually mean?

WP Memory Limit

What is WP Memory Limit and why should I increase it

WP memory limit is the max amount of server memory that any PHP script is able to make use of. So says the official PHP documentation: “This sets the maximum amount of memory in bytes that a script is allowed to allocate. This helps prevent poorly written scripts from eating up all available memory on a server.”

ADVERTISEMENT

WordPress will by default set PHP memory to 32MB, but 32MB is actually very small and thus rather limiting.

You most likely encountered the dreaded “Fatal Error: Memory Size Exhausted” ,that is why you are here and rightly so. You need to increase your WP Memory limit.

As mentioned in the intro, when implementing a full featured demo site from a premium theme 32MB will simply not suffice. In fact the operation will never complete and ultimately time out. The same goes for server heavy plugins or simply many plugins, not enough juice means bad luck to you buddy.

Three of ways to increase the WP Memory Limit

Option one – Use the .htaccess file

The .htaccess file allows you to make changes to your website’s configuration without having to edit server configuration files.

  • Search in your root directory for a file called .htaccess. The full stop should be before the word “htaccess” and there should be nothing before the full stop. This file is usually hidden by default so you will have to check your file manager settings and set “hidden files” to visible.
  • Add the following code to the file:
    php_value memory_limit 512M
  • Save and then refresh the site.

Option two – php.ini file method

There are restrictions on the php.ini file on many hosting providers so check if you can access this as your first step, if not go try the next option.

  • Locate or create your php.ini file
  • Look for the line that reads : memory_limit = 32M
  • Change the number (32) to your desired limit (e.g. 512)
  • Save and reload/restart your server

Option three – wp-config.php file method

Remember to play safe when access any php file on your website, make a copy so that if you make a fatal mistake you can just restore

  • In your root directory fine wp-config.php and open to edit
  • Look for ht eline that includes:
    define(‘WP_DEBUG’, false);
  • Just below that line add the following line:
    define (‘WP_MEMORY_LIMIT’, ‘256M’);
  • Save and then refresh your site

Upload Max Size

What is upload max size and why should I increase it

As the name might suggest, upload max size the limit to file size allowed to be uploaded to your WordPress sites. This is defaulted to 2MB but most will aggrege that this is a very low limit. Remember this includes any and all files, even plugins, so this will quickly become an annoyance.

You ofcourse have the option to do uploads via a FTP manager like filezilla but who wants to go through that process every time when WordPress offers uploading functionality right there where your writing your blog? If you use any videos of photos on your site your going to want to change this setting to something a bit more meaty.

Three ways to increase Upload Max Size

Option one – .htaccess file method

  • Locate your .htaccess file in the root directory
  • Add the following line :
    php_value upload_max_filesize 64M
  • Save .htaccess and refresh your wp site

Option two – php.ini file method

  • Locate or create your php.ini file and open it to edit
  • Find and edit the line or create it yourself: upload_max_filesize = 2M, changing the 2MB to what you prefer, 64MB for example
  • Save and restart your server

Option three – functions.php file method

Please check the warning in red at the beginning of this guide before applying this option

  • Find and open the functions.php file. Hopefully you find it in the child theme you’re using 😉
  • Add the following line to the file, careful not to put in a loop:
    @ini_set(‘upload_max_size’ , ’64M’);
  • Save the changes and refresh the site

Post Max Size

What is Post Max Size and why should I increase it

post_max_size refers to the mazimum size for any POST body data, file uploads count towards this limit also. Large files needs a high setting on both post max size and upload max filesize with post max size being the larger of the two.

Setting this up correctly to a large enough number means you can upload your files and posts with files directly from your CMS dashboard. It will also play a crucial role during demo content uploads.

Three ways to increase Post Max Size

Option one – .htaccess file method

  • Find your .htaccess file which is often hidden so remember to set “view hidden file” to yes on your file manager or FTP client\
  • Add the following line to the .htaccess file somewhere after the line that reads “# END WordPress”:
    php_value post_max_size 64M
  • Save your edits and reload your site

Option two – php.ini file method

  • Find or create your php.ini file and open it to edit
  • Add/edit the follwing line of code: post_max_size = 32M and change it to 64M or whatever size you prefer
  • Save file and then restart your server

Option three – functions.php file method

  • Locate your functions.php file within your themes folder then open it to edit it
  • Add the following line to your file :
    @ini_set( ‘post_max_size’, ’64M’);
  • Save functions.php and reload your site.

The Max Execution Time – PHP Time Limit

What is The Maximum Execution Time and why should I increase it

This setting determines the maximum time a script can run for on your site. This defaults to 30 seconds and once those 30 secs have expired the script stops running, followed by an error message : “The maximum execution time of 30 seconds exceeded“.

If this is not set to greater time frame you will encounter issues with running/installing a large plugin and as mentioned before whenever you want to import your premium theme demo content.

Three ways to increase The Maximum Execution Time

Option one – .htaccess file method

  • In your root directory discover the wo-config.php file and open it to edit
  • Find the folloing line :
    define(‘WP_DEBUG’, false);
  • Just below it add the folloing :
    set_time_limit(300);
  • Save wp-config.php and reload your site

Option two – php.ini file method

  • Find or create a php.ini file, usually in your root directory
  • Find the following line to edit or add it to your file :
    max_execution_time = 40
    and change 40 to 300 or higher
  • Save and reload server, boom

Option three – functions.php file method

  • Find your functions.php file, hopefully in your child theme folder
  • Add the folloing line to the file :
    @ini_set(‘max_execution_time’, ‘300’);
  • Save file and reload your site

The PHP Max Input Vars

What is PHP Max Input Vars and why should I increase it

PHP Max Input Vars refers to the maximum number of variables a server can use for a single function. This is defaulted to 1000 but modern premium themes require about 3000 Variables to be running for any function.

If you do not increase this number several things could happen. widgets may disappear, menu items could be truncated or missing, Theme Options data can be lost. It also plays a big role in the importing of demo content on your WordPress installation.

The PHP Max Input Vars helps protect against DDoS attacks so once your done with your operations is advised that you change it back to 1000 Vars

Two ways to increase The PHP Max Input Vars

Option one – .htaccess file method

  • Search within your root directory for the hidden file .htaccess and open to edit it
  • Add the following line to the file :
    php_value max_input_vars 3000

Option two – php.ini file method

  • Create or find your php.ini file
  • Edt or add the following line :
    max_input_vars = 1000
    and change 1000 to 3000

The PHP Max Input Time

What is The PHP Max Input Time and why should I increase it

PHP Max Input Time is the maximum time allocated to PHP scripts measured in seconds. This is defaulted to 30 seconds. Once those 30 secs are up the script simply stops running (completed or not) and you are presented with an error message.

As with many of the settings in this guide this setting plays a role in uploading files and importing theme demo content.

Two ways to increase The PHP Max Input Time

Option one – .htaccess file method
  • Locate the usually hidden .htacess file and open to edit
  • Add the following bit of code to the file:
    php_value max_input_time 3000
  • Save and reload your website
Option two – php.ini file method
  • You guessed it, find or create the php.ini file in your root directory and open to edit
  • Find this bit of code or add it to the file:
    max_input_time = 1000
  • Change the 1000 to 3000, save

Quick Reference Guide

All right, now we’ve worked through the step-by-step instructions for each individual setting. Here is the synopsis of everything you’ve learned so far.

Complete list of all changes made to php.ini file

The php. ini file is the default configuration file for running applications that require PHP. It is used to control variables such as upload sizes, file timeouts, and resource limits.

upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
max_input_vars = 3000
max_input_time = 3000

Complete list of all changes made to .htaccess file

The . htaccess file is a powerful website file that controls high-level configuration of your website. On servers that run Apache , the . htaccess file allows you to make changes to your website’s configuration without having to edit server configuration files.

php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_vars 3000
php_value max_input_time 3000

Complete list of all changes made to functions.php file

The functions.php file is a template included in all WordPress themes. It acts like a plugin for your WordPress site that’s automatically activated. The functions. php file uses PHP code to add features or change default features on a WordPress site.

@ini_set(‘upload_max_size’ , ’64M’);
@ini_set(‘post_max_size’, ’64M’);
@ini_set(‘max_execution_time’, ‘300’);

Complete list of all changes made to wp-config.php file

The wp-config. php is a configuration file that stores some of your website’s most important settings and configurations. It also contains your website’s database information. In short: If you don’t have the wp-config file, then your WordPress site won’t be able to establish a database connection.

set_time_limit(300);
define (‘WP_MEMORY_LIMIT’, ‘512M’);

Final Thoughts

Following this guide ,you can fix your own WordPress memory limit issues and circumvent those pesky error screens while you’re running your server heavy plugins or importing your theme demo content. Please do take note of the RED warning blocks and take the necessary precautions so that you do not create more work for yourself or your developer. Just remember this, back up twice for every change.

author avatar
Jamie Rautenbach
I'm a bit of a tech head and a gamer. In love with the crypto scene, I try to spend as much time time in the real life because I am more often than not lost in Web3, looking over altcoin charts and researching the latest play to earn games and DeFi developments.
See Full Bio
Tags: TechnologyWordPress Frequently Asked QuestionsWordpress Support
  • About
  • Terms and Conditions
  • Corrections & Complaints
  • Contact Us
South Africa News, Entertainment, Lifestyle, Sport.

© saffarazzi.com. All Rights Reserved. Privacy Policy.
hello @ saffarazzi.com

No Result
View All Result
  • HOME
  • RECIPES
  • NEWS
  • ENTERTAINMENT
  • LIFESTYLE
  • MOTORING
  • LOTTO RESULTS
    • Daily Lotto
    • Lotto and Lotto Plus
    • Powerball and Powerball Plus
    • UK Lottery
      • Thunderball
      • Lotto UK
      • EuroMillions
      • Set For Life
  • About Us
  • Write for us!
  • Contact Us
  • Privacy & Terms
  • Corrections & Complaints

© saffarazzi.com. All Rights Reserved. Privacy Policy.
hello @ saffarazzi.com

← Soweto protests: Thokoza Park residents disrupt Friday traffic ← Less than 10% of African countries will hit vaccination goal
No Result
View All Result
  • HOME
  • RECIPES
  • NEWS
  • ENTERTAINMENT
  • LIFESTYLE
  • MOTORING
  • LOTTO RESULTS
    • Daily Lotto
    • Lotto and Lotto Plus
    • Powerball and Powerball Plus
    • UK Lottery
      • Thunderball
      • Lotto UK
      • EuroMillions
      • Set For Life
  • About Us
  • Write for us!
  • Contact Us
  • Privacy & Terms
  • Corrections & Complaints

© saffarazzi.com. All Rights Reserved. Privacy Policy.
hello @ saffarazzi.com