Increase PHP memory limit

How to increase PHP memory limit in cPanel?

Increase PHP memory limit

In every PHP installation, there will be a default setting. For certain situations, we have to edit that for some websites. The default memory limit for WordPress is 32MB. For most of the sites, 128MB will be more than enough unless the plugin/theme that you install demands more.

You may face an error like Fattal error: Allowed Memory Size or

Fatal error: Allowed memory size of 23556632 bytes exhausted (tried to allocate 3349917 bytes) in /home/xxxxx/public_html/wp-includes/plugin.php on line xxx

Most of the time this error comes when you installing and activating themes or uploading images. In this case, you have to increase the memory limit for that website

There are two possible solutions through which you can increase the PHP memory limit,

1.Increase PHP Memory Limit through MultiPHP INI editor

2.Increase PHP Memory Limit through wp-config file

Steps to Increase PHP Memory Limit through MultiPHP INI editor

Step1: Login

Login to the cPanel Account of the website to which you need to increase the memory limit

Step2: Multi PHP Ini Editor

After login to cPanel, search as MultiPHP INI Editor. You will find this under the Software section.

MultiPHP INI Editor in cPanel

Step3: Basic Mode

In MultiPHP Ini Editor, there will be two types of modes, Basic mode & Editor Mode. Click on Basic mode. In the ‘Configure PHP INI basic settings’ select the location which is the domain’s root document to open the corresponding PHP configuration.

PHP INI basic settings

Step4: PHP Directives

You can see the list of PHP Directives. In the ‘memory_limit’ directive, enter the maximum limit that your site needs.

Note: The memory limit should be greater than post_max_size and post_max_size should be greater than upload_max_filesize. Also, increase only to limit it requires as providing a higher limit may lead to security concerns.

Finally, click Apply to save the changes.

Increase Memory Limit

 

Steps to Increase PHP Memory Limit through wp-config

Step1: Login

Login to the cPanel Account of the website to which you need to increase the memory limit

Step2: File Manager

Search as File Manager and click on it.

File Manager in cPanel

Step3: Navigate to public_html

After entering into file manager, navigate to public_html

public_html in cPanel

Step4: wp-config file

In public_html, you can fine wp-config file. Right click on it and edit the wp-config file.

Find the line “/* That’s all, stop editing! Happy publishing. */”

Add this line define(‘WP_MEMORY_LIMIT’, ’64M’); above those line.

Finally, click on Save Changes

Also, Learn about increasing the Upload Limit Size here through MultiPHP INI Editor in cPanel.