Recommended Server Settings – Memory issues

There are hundreds of thousands of web hosts out there, not all of them are fit for a WordPress installation. There are a few (well-known) low budget host providers that you can experience multiple issues when you use a premium, high quality theme (demo import issues, images upload etc). As you can easily understand this is out the scope of our support and something that you need to sort out with your host provider. At least, make sure you have covered the basics: WordPress Minimum Requirements

Recommended PHP and MySQL versions:

  • PHP 5.6 or greater
  • MySQL 5.5 or greater
  • The mod_rewrite Apache module

Themes and Plugins often require more memory than the server default values. In some server installations some php variables are very low and not recommended for WordPress installations with premium Themes or/and multiple Plugins.

Recommended php variable values:

Snippet for php.ini

    memory_limit = 256M 
    post_max_size = 128M 
    upload_max_filesize = 32M  
    max_input_vars = 2000
    max_execution_time = 300​

Snippet for .htaccess

  php_value memory_limit 256M
  php_value post_max_size 128M
  php_value upload_max_filesize 32M
  php_value max_input_vars 2000
  php_value max_execution_time 300​
  • memory_limit ( This sets the maximum amount of memory in bytes that a script is allowed to allocate)
  • post_max_size ( Sets max size of post data allowed. This setting also affects file upload. )
  • upload_max_filesize ( The maximum size of an uploaded file. e.g: Theme, Plugin, Media File )
  • max_input_vars ( Increase to 2000 to enable large menus with many menu items e.g > 80 )
  • max_execution_time (The maximum time in seconds a script is allowed to run before it is terminated )

Note: If you have already a larger number or if you don’t have any issues, you don’t need to modify them.

Keep in mind that some values must be larger than others: memory_limit > post_max_size > upload_max_filesize

These values can be changed with the following methods:

  • inform your hosting provider to do it for you
  • from you hosting panel
  • php.ini ( FTP access required )
  • .htaccess ( FTP access required )

One of the most important files in your WordPress installation is the wp-config.php file. This file is located in the root of your WordPress file directory and contains your website’s base configuration details, such as database connection information.

WP_MEMORY_LIMIT option allows you to specify the maximum amount of memory that can be consumed by PHP. This setting may be necessary in the event you receive a message such as “Allowed memory size of xxxxxx bytes exhausted”.

This setting increases PHP Memory only for WordPress, not other applications. By default, WordPress will attempt to increase memory allocated to PHP to 40MB. Increasing memory allocated to PHP

Increase PHP Memory to 96M

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

Administration tasks require much memory than usual operation. When in the administration area, the memory can be increased or decreased from the WP_MEMORY_LIMIT by defining WP_MAX_MEMORY_LIMIT.

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

Please note, this has to be put before wp-settings.php inclusion.

Related Articles