Some WordPress plugins may require an increased memory limit, for example WooCommerce has a value of 64MB.
The WordPress memory limit may be increased by modifying configuration files. 3 files where the WordPress memory limit may be set:
- php.ini
- .htaccess
- wp-config.php
Any of these files may be edited to achieve the increase in the WordPress memory limit. The approach taken is as likely to be based upon personal preference.
If you are making changes to a site hosted on a shared hosting server co
php.ini
It is probable that the php.ini file may not exist, if not create a new one and add in the increased memory limit. The file is to be saved in the root of the website, the same location as the other two files mentioned here.
Adding the value here allows for updates to the core WordPress without the worry that it will overwrite anything.
If you are editing an existing php.ini file search for memory_limit and change its value to 64 M or 128 M as required.
If you are creating a new file, or the value has not previously been configured add the following line at the end of php.ini file:
memory_limit = 64M;
.htaccess
The .htaccess file may be used for the configuration of a number of the site settings. For example the redirect permalink settings.
Adding the memory limit in this file keeps it separate from the WordPress files. This may protect it from being over written.
To make the setting add the following to the .htaccess file
php_value memory_limit 64M
This file is not available on the Windows hosting environment.
The file is commonly used on Apache hosted websites to configure such entities as site access, redirection and blocking.
wp-config.php
Like the other files the wp-config.php file is located in the root of the website.
It may be construed that the memory limit is specific to the WordPress website and therefore adding it as a setting in the wp-config.php is the best place for it.
The file already exists, open it and check to see whether the memory limit has been configured and if not add the line
define(‘WP_MEMORY_LIMIT’, ’64M’);
File Editing
The files may be edited either through the website hosting configuration panel (if available as an a option) or more practically by editing a local copy and saving this to the website using FTP.
I prefer to take a local copy of the website and to make the changes, re-uploading the edited files.
This ensures that I have a copy of the website which is up to date. Editing the files through the hosting control panel is likely to lead to out-of-sequence between the live site and the local copy.
When editing files don’t use editors such as Word, Writer and Wordpad. These editors are likely to add additional characters into the file which can lead to errors in the formatting and understanding of the entries.
Having used different editors over time my current preferred options are Geany and Bluefish, both an easy install on Debian. Their project sites are:


