Increase Memory Limit Wordpress [2025] 💥
Your website is showing issues and you need to increase the memory Limit of Wordpress to fix this. We will show you the best and fastest ways to do this. Depending on your hosting situation you will have a preferred method.
Advertisement
1. Increase Memory Limit Wordpress with WHM (Cpanel)
By far the best way to increase the memory Limit for Wordpress if you control the server is using your WHM panel. Use the searchbox in WHM, type: "PHP". In the menu on the left click on "MultiPHP INI Editor". On top you have to pick the PHP version that your website is using. I normally edit all available version at once so they all have the same settings but tht is not necessary at the moment I guess.
Now open your browser's searchbox with keyboard shortcut CTRL+F and type: "limit" and hit ENTER. You will now see "memory_limit" where you can edit the value.
2. Increase Memory Limit Wordpress with Cpanel (account)
If you don't have access to the complete server but only to one Cpanel account, you can still use the "MultiPHP INI Editor" although it works a bit different here. Use the searchbox in WHM, type: "PHP". In the menu below click on "MultiPHP INI Editor". Select "Home directory". Just scroll down and increase the value for memory limit. See screenshot below. You can also read Cpanel's MultiPHP INI Editor documentation.
3. Increase Memory Limit Wordpress editing wp-config.php
The wp-config.php file is located in your Wordpress root, which would normally be the public_html. Add to following code below to the file. In case you find a similar code present already, then just up the value for the memory limit. For example from 64 to 256 or 512.
define('WP_MEMORY_LIMIT', '256M');
4. Increase Memory Limit Wordpress editing .htaccess
The .htaccess-file can be used to relay instructions to your server without needing to modify your server configuration files. If you are unable to access your PHP.ini file,.htaccess is a viable alternative.
You can access the file by connecting to your server with an FTP client as described in previous sections. The public_html directory contains the .htaccess-file. Open this file now and add the following code snippet after/below the # END WordPress line. It should look more or less like in the screenshot below.
php_value memory_limit 256M
5. Increase Memory Limit Wordpress editing php.ini with SSH
You will need to log in with the required permissions to modify the php.ini file using SSH. This typically means that you must have root access. The directory that contains the main php.ini file is listed below.
/usr/local/lib/php.ini
You can simply type in the following to open it.
vi /usr/local/lib/php.ini
First typing in a ":" to enter command mode. After php.ini can now be edited, we can search for the memory_limit variable by writing:
/memory_limit
This will locate the line that contains the parameter to be removed from the memory limit. Click the "Insert” button to modify the memory limit. You can change it, for example, from 128 MB up to 256 MB.
You can exit the insert mode by pressing the "Esc" key. To enter the command mode again via the ":", simply type "x" followed by "Enter". This will save all changes and bring you back to the command prompt. After php.ini is modified, you can restart Apache using the following command.
service httpd restart
Thats's it!
Advertisement