User Tools

Site Tools


Sidebar

tutorials:memory_errors:start

This is an old revision of the document!


PHP Memory Limit Error When Using Software

This error most often happens when clients of your are uploading images to attach to their listings but can occur in some instances under basic script use with the default php memory limit value set at 8MB. The most common error looks something like (if you see one in the browser at all):

Fatal error: Allowed memory size of ######## bytes exhausted (tried to allocate ##### bytes) in /home/public_html/classes/order_items/images.php on line ####

The above error means that PHP does not have sufficient memory to do what it is trying to do within our software. This error can appear when managing large amounts of categories within the admin tool as a few queries need to be sometimes on many categories to create the database relationships between categories. When uploading images more memory is needed for components like the Geo script itself, any "background" php modules loaded, the GD image manipulation library, the uploaded image itself, working space for GD library to create the thumbnail and space for the thumbnail created. All of those components need to be in memory at one time making the image upload process the most memory "conscious" process our software has to do.

You may not always see this error in the browser. Your host/server may have turned off the display of PHP errors to the browser to slow down hacker. Some information about server paths on the server through errors. In these cases you may need to consult a PHP error log to find the specific error.

As far as what memory limit you should have there is no telling. We seen our software work well in the default 8MB value that comes default. Then still other servers where that is not sufficient. Almost ALL memory limit problems happen when uploading images. On some servers we have seen the 64MB is the first value that doesn't cause any problems when uploading images. Our first suggestion is 16MB then 32MB then 48MB and finally 64MB. Keep increasing the value until you no longer see the error when uploading images.

The memory limit is a PHP environment variable set within the php.ini file. The php.ini file provides all of the configuration information PHP needs at start up. Many hosts allow you the ability to edit the php.ini file directly. Other hosts allow you to override some or all of the server wide php.ini values by inserting a php.ini file with the override values in your working directories. Still other hosts want complete control of this file and any changes to that file requires them to make those changes. As to which of the above situations happens with your host you will need to contact them to have the value changed.

tutorials/memory_errors/start.1235586955.txt.gz · Last modified: 2014/09/25 16:55 (external edit)