How To Increase PHP Memory Limit Print

  • PHP, memory limit, hosting
  • 1

Some PHP application require higher PHP memory limit than the default hosting setting. For example, Wordpress require atleast 128MB, Elementor page builder recommend 256MB or greater, and Woocommerce recommend 256MB or greater. PHP memory limit sets the maximum amount of memory in bytes that a script is allowed to allocate. This helps to prevent poorly written scripts for eating up all available memory on a server.

In other words, PHP memory limit is the maximum amount of server memory a single PHP script is allowed to consume. When the script use up the memory until the threshold, PHP engine will block and the resulting error output looks something like this

Fatal error: Allowed memory size of x bytes exhausted (tried to allocate x bytes) in /path/to/php/script

or like this :

PHP Fatal error: Out of memory (allocated x) (tried to allocate x bytes) in /path/to/php/script

To fix this issue, we have to increase the PHP memory limit. Follow the instruction below to increase the PHP memory limit :

1) Login to cPanel and search for "multiphp ini editor". Click on it.

 

2) Choose which domain you would like to increase the PHP memory limit.

 

3) Scroll down to PHP Directive and search for memory_limit. Set the value you would like to have. In this case, we set to 256MB

 

4) Click apply & done ! Check your website.


Was this answer helpful?

« Back