How to increase the PHP memory_limit

Post Reply
User avatar
Team Member
Posts: 132
Joined: Mon Jul 19, 2021 1:41 am
Has thanked: 16 times
Been thanked: 3 times

At times, you might come across the error message: "Fatal Error: Memory Size Exhausted," or perhaps your website simply displays a blank page? This issue commonly arises when installing a new theme, incorporating a plugin, or updating the WordPress version. Is the website operating at a reduced speed or experiencing server overload?

The primary source of this error is your host's PHP memory_limit being insufficient for your process's requirements. In such instances, it becomes necessary to enhance the host memory limit to ensure process completion.

The PHP memory_limit can be configured to limit the amount of memory scripts are permitted to allocate, measured in bytes. This configuration is beneficial to prevent ill-coded scripts from consuming the entire server's memory.

Increasing PHP memory_limits might be necessitated for various other purposes. The default memory limit of PHP can differ, contingent on the server's setup.

The default PHP settings suffice for operating most websites with every PHP installation. However, to cater to specific requirements of a website, occasional adjustments in PHP settings might be requisite. Accordingly, it might be imperative to augment the memory_limit on your site to facilitate the conclusion of a process.

For example, let's say you want to change memory_limit for

First, check what PHP version you run on the domain.

In your SSH run:

Code: Select all

sudo /usr/local/vesta/bin/v-get-php-version-of-domain
For this domain, the resulting output will be:

Code: Select all

Now in your SSH, as root, edit it's FPM conf file:

Code: Select all

sudo mcedit /etc/php/8.0/fpm/pool.d/
In this file path example, the PHP version is 8.0 and the domain is


Code: Select all

php_admin_value[memory_limit] = 512M
To apply your desired modifications, simply restart PHP-FPM by executing the following command:

Code: Select all

sudo systemctl restart php8.0-fpm
(in case when you use some other PHP version different than 8.0, just change 8.0 to propper version)
Post Reply