Fixing PHP Fatal Error: Allowed Memory Size Exhausted.

A common error with open source software like WordPress, Moodle, and Joomla is the PHP "Allowed Memory Size Exhausted" Increasing the memory limit is an easy solution. This memory_limit can be changed in the php.ini in the public_html folder in your hosting account. This error can creep up in your website during the normal development process. The following is an example of the error: 
Fatal error: Allowed memory size of 268435465 bytes exhausted (tried to allocate 280559520) in Unknown on line 0
This is due to php variable data being stored in the memory that is not cleared while the php scripts are running.
For those who code their own sites: Coders use the unset() function to clear variable data that is no longer needed, however with open source software, you will not want to alter any code.

How to fix the PHP "Allowed Memory Size Exhausted".
The PHP memory resource can be increased in the php.ini located in the public_html. The following steps will explain how to set the php.ini to allow a larger amount of memory use.

Step 1: Login to your cPanel.
Step 2: Go to the File Manager. - Select the Web root (public_html/www) directory and click Go.
Step 3: Find the php.ini file in the public_html. - Open the php.ini with the code editor.
Step 4: Find the following section in the php.ini file.

Try increase the memory_limit value to 256M.

If the PHP memory_limit is already at 256M, you can increase it to 512M. Save the changes.

Now visit the site. You should not see the "Allowed Memory Size Exhausted" error anymore. If the error still shows on your website, there may be a setting within the software itself that is overriding the change or the php.ini in the public-html may be overriden by another setting elsewhere. If this is the case, you can contact our our tech support staff to have them look into the error further.

Ця відповідь Вам допомогла?

 Роздрукувати цю статтю

Також прочитайте

Monitor WordPress PHP Errors

Close monitoring of your site’s PHP errors is crucial to operating a healthy, secure, and...

PHP Ownership/Permission Issues.

"Bad File Descriptor" Errors in FTP*Note that this applies to servers running mod_php only* As...

Fixing 500 Internal Server Error.

This article describes ways to minimize the occurrence of "500 Internal Server Error"...

Turning On PHP Errors.

For security reasons, most web servers have PHP errors turned off. This makes sense on live sites...