Fatal error: Allowed memory size of 20971520 bytes exhausted (tried to allocate 9144 bytes) in

Fatal error: Allowed memory size of 20971520 bytes exhausted (tried to allocate 9144 bytes) in

Fatal error: Allowed memory size of 20971520 bytes exhausted (tried to allocate 9144 bytes) in /xxxx/local/home/xxxx/includes/common/lib/image/KT_Image.class.php on line 1247
divider

Fatal error: Allowed memory size of 20971520 bytes exhausted (tried to allocate 9144 bytes) in /xxxx/local/home/xxxx/includes/common/lib/image/KT_Image.class.php on line 1247

When you receive this error while uploading a file (image or other) you most probably sitting with limitations on your php configuration on your server.

Do the following.

Create a php page, call it what you want and add this code to it;

<?phpphpinfo()?>

Upload it to your server and run it look for the following sections

upload_max_filesize = xxMmemory_limit = xxpost_max_size = xxM

where xx is the maximum allowed size.

Make sure your file you are trying to upload is below these settings.

How to fix the limits?

Depending on what server configuration (shared, VPS or dedicated server) you have you can edit the php.ini file to increase the settings.
In most cases, you will not be able to change these settings in a shared environment because it uses more server resources and your ISP is limiting these to allow a harmonious existence between all sites on the server.

If you are on a VPS or dedicated server, update your global php.ini and remember to restart "Apache" for it to take effect.

Another possible problem might be a corrupt file.

You are uploading an image and specifies it as a jpg file, the server tries to re-size or do something with it and can't because the file is corrupt. You might end up with either an out of memory error or the process might simply time-out.

Other issues:

Recently I transferred a Joomla site to my server. The site worked perfectly on the old server under a dual installation of php 4.xx and 5.29. My server only has php 5.29 installed. I received an out of memory error displaying a menu module...
The problem was nothing to do with the menu, in fact, it ended up being a problem with a PHP directive in the php.ini file forcing the site to run under PHP 4.x. Remove the line in the php.ini and problem solved.

Log-files

There are a couple of log-files you can look at.

  • Server logs, depending on what hosting environment you are on, they might not be available to you as the users. Ask your host to take a look at these.
  • "Site Logs", inside the root folder of the file you are trying to execute on the site you should find an error.log file.
Written by:  - 21 Feb, 2010