How to increase the PHP memory_limit

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

At times, you might come across the error message: "PHP Fatal error: Allowed memory size of 268435456 bytes 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 yourdomain.com

In your SSH run:

Code: Select all

v-edit-domain-php-ini yourdomain.com
Change the line:

Code: Select all

php_admin_value[memory_limit] = 512M
Press F2 and confirm Save.
Press ESC twice to exit the editor.
Post Reply