How to Edit the PHP Memory for Your WordPress Site via WP Toolkit

Posted on by Luke Cavanagh
Reading Time: 6 minutes

When creating a new installation WordPress site using the WP Toolkit in cPanel or Plesk, the PHP memory will be 32MB by default. WordPress's default recommended PHP memory limit should be at least 128MB. If your active plugins need more PHP memory, then the other recommended PHP memory change would be 256MB or 521MB and increase to those higher PHP memory levels. 

The WP Toolkit default memory limit of 32MB is set at the most conservative PHP memory for most hosts' usage. If you do not increase the PHP memory limit on your WordPress site, you will run into issues of active plugins running out of PHP memory. Or if you are using the WP Toolkit for updating plugins or themes using the smart updater feature, they will typically run into out-of-PHP memory issues.

Requirements 

  • Access to your WHM account.
  • Access to your cPanel or Plesk account.
  • Awareness of how to use the multiPHP editor.
  • Awareness of the integrated file manager in cPanel or Plesk.
  • SSH credentials for your WordPress site.

Edit PHP Memory for Your WordPress Site via WP Toolkit

cPanel

Step 1:

Log in to your cPanel account, then go to the MultiPHP INI Editor and look for the line on memory_limit. You can log in to your cPanel account either directly or from WHM, and then list out all of the accounts and select the correct cPanel account.

Step 2:

The value for memory_limit, should be increased from 32M to 256M. Then, once that is updated, apply those changes.

Alternative Method

This alternative method is not necessary if you are able to edit the memory limit on the PHP version that is used on the site. Use the file manager you can find from within cPanel for your site account. The file that you will need to edit is the wp-config.php file.

The constant to set the PHP memory limit in the site’s wp-config.php file.

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

If you need more PHP memory, then you can increase that amount to 512MB by setting this constant in the site's wp-config.php file.

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

Save the changes to the wp-config.php file. You can also edit the wp-config.php file using SSH credentials for your cPanel server and then use your preferred file editor application.

Step 3: 

Verify that the PHP memory has been updated correctly by updating a plugin or theme using the Smart Updates feature in cPanel.

Step 4:

Log in to the WordPress dashboard of your site and check to confirm that it works as expected. Commonly expected tasks in the WordPress dashboard would be that the plugin list loads, and you can edit posts or pages on the site. Settings for active plugins would load correctly in wp-admin, and once you are logged into your WordPress site, no PHP memory errors are showing on the front-end of your site with the admin bar still visible.

Plesk

Step 1:

Log in to your Plesk account and go to Websites & Domains. In the dashboard of the site, in the Dev Tools section, you can see which version of PHP is set for the site.

Step 2:

The value for memory_limit is set as the default 128MB and can be increased to 256MB.

Change the memory_limit value to 256M and then save the changes.

Alternative Method

This is an alternative method if you are not able to update the PHP memory limit directly when you edit the PHP values. Then you can use the file manager, which you can find within Plesk for your site account. The file that you will need to edit is the wp-config.php file.

The constant to set the PHP memory limit in the site’s wp-config.php file is below.

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

If you need more PHP memory, then you can increase that amount to 512MB by setting this constant in the site's wp-config.php file.

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

Save the changes to the wp-config.php file. You can also edit the wp-config.php file using SSH credentials for your Plesk server, and then use your preferred file editor application.

Step 3: 

Verify that the PHP memory has been updated correctly by updating a plugin or theme using the Smart Updates feature in Plesk.

Step 4:

Log in to the WordPress dashboard of your site and check to confirm that it works as expected. Commonly expected tasks in the WordPress dashboard would be that the plugin list loads, and you can edit posts or pages on the site. Settings for active plugins would load correctly in wp-admin, and once you are logged into your WordPress site, no PHP memory errors are showing on the front-end of your site with the admin bar still visible.

Final Thoughts

Increasing the PHP memory limit for your WordPress site can help improve the active plugins stability of your website. PHP is the scripting language used by WordPress to execute code and generate dynamic content.

WordPress plugins and themes can use a lot of memory, especially if it is poorly coded or not optimized. When the PHP memory limit on your WordPress site is too low, it can cause your website to crash and display error messages.

By increasing the PHP memory limit, you can give your WordPress site more resources, improve user experience, and have fewer error messages. It's important to note that increasing the PHP memory limit can also increase your site's server resource usage, so monitoring your site's performance and adjusting the limit as needed is essential. If your site needs more than 2GB of PHP memory, then it is very likely that you have active plugins, custom code snippets, or a feature in the active theme that is causing a memory leak and spiking your server's memory usage. If your CPU usage is showing as being very high, then that would also be worth checking out. By using an interactive process viewer, such as top or htop, you can find out which processes are running on the server and how much memory is being used.

Commonly used plugins that require higher PHP memory would be page builder plugins, such as Elementor and Beaver Builder. This would be to render out dynamic content. Backup plugins, such as UpdraftPlus, or security plugins, such as Wordfence, can require PHP memory to create backups and run site security scans.

To keep PHP memory levels down, it is not recommended to run resource-intensive automation and marketing requests. It is recommended to use automation and marketing platform services with integration plugins, rather than trying to directly run site automation plugins and email bulk marketing plugins that run internally on the site. Those cron events and processes can spike CPU usage and cause long-term performance issues on your site.

You can run into many issues if you do not increase the PHP memory from the default 32MB. Commonly noticed problems would be if you are running security or backup plugins, which require more PHP memory to be available. Also, if you are running an e-commerce plugin on your site, such as WooCommerce, you should increase the PHP memory to at least 512MB.

Without increasing the PHP memory on your WordPress site using the WP Toolkit, you will notice out-of-memory issues when trying to update WordPress core, plugins, and themes using the Smart Updates feature to test those updates on your site safely.

Avatar for Luke Cavanagh

About the Author: Luke Cavanagh

Product Operations Manager at Liquid Web. Devoted husband and Tween wrangler. Synthwave enthusiast. Jerry Goldsmith fan. Doctor Who fan and related gubbins.

Latest Articles

Blocking IP or whitelisting IP addresses with UFW

Read Article

CentOS Linux 7 end of life migrations

Read Article

Use ChatGPT to diagnose and resolve server issues

Read Article

What is SDDC VMware?

Read Article

Best authentication practices for email senders

Read Article