PHP and WordPress Memory Limits

“Composium – Visual Composer Extensions” provides a multitude of new elements and settings that can potentially slow down your WordPress installation. Particularly activating many elements and featuers, as well as multiple icon fonts (plus a custom uploaded one) can contribute to a slow down (or even break down) if not sufficient memory has been allocated to your server and the WordPress installation. Also, the more plugins and theme features hook into the post/page creation process by providing additional features, the more your site could slow down (or break down), when attempting to edit a page or post.

Shared Hosting Plans / Low Level Hosting Plans

If you are on a shared hosting plan and/or subscribed to a low level / performance plan, you are literally sharing the server your site is hosted on with a number of other sites from other users. How many sites the server is handling is different for each server setup and hosting company. Because every server has only so much overall memory and CPU capacity, the hosting company will impose internal limits as to how much any single site on that shared server is allowed to use; and no matter how much memory you are requesting from the server, you will never receive any more than what the internal limit set by your provider allows you to use.

Such limitation is necessary by your hosting company in order to ensure that there are always sufficient resources on the server to handle all sites that are run via that server. Imagine if just one site alone would request most or even all of the server memory for itself … there wouldn’t be anything left for the other sites that share the same server! Therefore, if following the steps provided below don’t seem to make a difference, chances are that your site is exceeding such internal limit and you really need to contact your hosting company for further assistance.

Also, it is impossible for any plugin or theme to “read” or “check” for those internal limits; all that is possible is to “read” the amount of memory your site is REQUESTING from the server via php.ini and/or wp-config.php files. Therefore, even if the memory checks conducted by this plugin indicate that you have sufficient memory remaining, it is based solely on the amount of memory you requested, as it is not possible to determine how much memory your site actually receives from the server. Therefore, use any those checks with caution as those checks, by nature of those hidden internal limits, are inherently flawed.

Live Monitor Memory Usage

There is an awesome free plugin available from the official WordPress repository, that will live monitor your servers memory usage after each page has loaded (logged in users only):

https://wordpress.org/plugins/query-monitor/

As stated before, no plugin will be able to tell you how much memory your server really allows for; it can only tell you how much is currently used. This plugin will also provide you with detailed information about any PHP errors or warnings that have been encountered when a page renders, which can be very helpful in troubleshooting all kind of problems. So if you suspect any memory limitations and/or other problems on your server, we highly recommend using this plugin.

Increase Memory Limits

Some hosting services allow you to manually increase the memory limit for the PHP server, while others require you to contact them and request an increase. If your hosting service allows you to do it yourself, you can use the steps below. Before making any changes to files, make sure you keep a copy of the original file so you can restore everything in case something goes wrong. Also, realize that you are only sending a REQUEST to the server; it is up to the server and your hosting company to fulfill that request!

To increase the memory limit that has been assigned to your PHP server itself, you can edit the “php.ini” file found on your server and add/change the following line:

 A minimum of 128 MB is recommended, but more is always better, particularly on sites with multiple large scale plugins and/or premium theme. If possible, set the value to 256M, which should be more than sufficient for most websites.

While that line will affect the PHP server that is hosting your site, you will also have to make a change to your WordPress installation itself. In the WordPress main directory, find the file “wp-config.php” and check if the file includes a line that is similiar to this:

That line defines how much of the PHP memory WordPress is actually allowed to use. Increase that number (value should equal the memory limit set in the “php.ini” file) and re-upload the changed file to your WordPress folder.

PHP in Apache Mode

If your PHP server is running in Apache mode and you don’t have direct access to the “php.ini” file but are allowed to create/change a “.htaccess” file, you can attempt to use that file to increase your server memory limit. Find the “.htaccess” in your root directory of the specified domain, if there isn’t, create one. Put the following line in it:

Drupal Server

For drupal, there is another choice, you can edit “sites/default/settings.php”. Locate the PHP settings section and add the following line at the end of that section:

Increase Failed

There are many reasons that can lead to increase failed (also see section about shared hosting plans). If you are a shared hosting user, the most possible reason is: Your hosting vendor does not allow for increasing the PHP memory limit (beyond a certain value), in this case, contact your host to increase the PHP memory limit for you or consider upgrading to a higher hosting plan and/or changing your service provider all together.

Tekanewa

Tekanewa has written 35 articles

Hi there, I am the Lead Developer here at Tekanewa Scripts by Kraut Coding; well, to be honest, I'm also the only developer. I love to create something beautiful and useful for Websites and here I write about how to use them. :)