Once running the PHP website source code, it is certain that your website has encountered at least one of the prevalent errors. And “fatal error: allowed memory size of 134217728 bytes exhausted” is regarded as the most common error. This error is a headache for many website owners.

If you are looking for an advantageous solution to tackle this problem. Luckily, in this blog, we will cater to 2 useful solutions to help you address this issue effectively. First of all, you need to determine the reason why this error appears on your website.

Why is this error coming to your website?

This error occurs as the PHP application processes are loading a massive amount of data that consume a large of RAM and memory resources that you have specified in the php.ini file via “memory_limit”. Therefore, this error appears to request you to increase more memory so that the PHP process can operate stably.

So, in order to handle the “fatal error: allowed memory size of 134217728 bytes exhausted” error, you need to implement the two following ways. Let’s check them out.

Fatal Error: Allowed Memory Size Of 134217728 Bytes Exhausted

How to deal with “Fatal error: allowed memory size of 134217728 bytes exhausted” error

Method 1: Edit the value of memory_limit to increase it in the phi.ini file

Step 1: Locate the php.ini file

Let’s run the following command to locate the position of php.ini file.

vi /etc/php.ini

Step 2: increase the value of memory_limit

We assume that currently, your memory_limit is 128M, you need to change memory_limit to double. For example:

Change from:

memory_limit = 128M

to:

memory_limit = 256M

Step 3: Restart the PHP server

To restart the PHP server, you need to run the following command:

  • If PHP is an apache module, then you run:

/etc/init.d/httpd restart

  • If PHP works as PHP-FPM, let’s run:

/etc/init.d/phpfpm restart

Method 2: Change memory_limit from .htaccess file

In case, you don’t have the access authority to edit the php.ini file on your system, you can modify memory_limit with a .htaccess file. All you need to do is change as below:

vi ./.htaccess
php_value memory_limit 256M

After that, don’t forget to save your changes and check if the error is gone.

Sum up

Were those mentioned solutions useful for your “Fatal error allowed memory size of 134217728 bytes exhausted” error? If yes, don’t forget to share with us your result by leaving a comment below. Additionally, if you get into any trouble or other errors, and you need our assistance, we will support you as soon as possible. Thanks for your reading and see you soon in the next troubleshooting blogs.

By the way, you can visit our free WordPress theme to explore a dozen of stunning, SEO-friendly designs.

5/5 - (1 vote)
Lt Digital Team (Content &Amp; Marketing)

Summer Sale Grab 50% Off for everything on today, don't miss it. Coupon code: SUMMER2024 Redeem Now
Summer Sale Grab 50% Off for everything on today, don't miss it. Coupon code: SUMMER2024 Redeem Now