WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Fatal Out of Memory Error for adding images to new Posts (6 posts)

  1. morriswt
    Member
    Posted 5 years ago #

    I am running wordpress 2.8. Last night, I started getting PHP out of memory errors for whenever I started attaching images to my posts.

    I would receive the following messages:

    Fatal error: Out of memory (allocated 42205184) (tried to allocate 3072 bytes) in /home/morriswt/public_html/wp-admin/includes/image.php on line 147

    My hosting provider already has the PHP memory limit set to 64MB. I am not sure what else to do. Please advise me on next steps.

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    Fatal error: Out of memory (allocated 42205184) (tried to allocate 3072 bytes) in /home/morriswt/public_html/wp-admin/includes/image.php on line 147

    My hosting provider already has the PHP memory limit set to 64MB.

    Given the error message, I'd say that your hosting provider actually set the PHP memory limit to 40 MB, not 64 MB. See the "allocated 42..." message?

    Short of it is that you either a) need more memory or b) need to reduce the amount of memory you're using. You can do A by getting the hosting provider to up the limit, or B by removing plugins and other things taking up all that memory. A default WordPress 2.8 install fits into 32 MB of memory on almost all hosts (except for one special case that is fixed in 2.8.1, and which does not apply here).

    Also, uploading images and creating thumbnails from them takes *loads* of memory, just to read in the full image. If you resize your image to web sizes before uploading it (instead of uploading the full sized camera image), then it will take much less memory. Rule of thumb: megapixels = megabytes. An 8 megapixel image requires at least 8 megabytes of additional memory just to read it in and process it.

  3. morriswt
    Member
    Posted 5 years ago #

    Otto,
    Thank you for the re-sizing suggestion. I can assure you that my host's memory setting for PHP scripts is 64MB. Your re-sizing suggestion worked and makes sense to do.

    Thanks,
    Tim

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    I can assure you that my host's memory setting for PHP scripts is 64MB.

    I can assure you that that simply cannot be the case, given the error message you gave earlier. The error message *says* what the memory settings are.

    It ran out of memory when 42205184 bytes were allocated and it wanted to allocate 3072 more. Now, 42205184 bytes = exactly 40.25 Megabytes. Given that .25 makes sense for PHP itself, the setting of max memory is set to 40MB. Not 64MB.

    That said, I'm glad resizing the image works for you.

  5. kevmac27
    Member
    Posted 4 years ago #

    I'm having the same issue. My hosting company said it is probably because the process that WP is using to upload the image is using the rest of it. I don't know if that helps.

    Unfortunately I am trying to make this simple for my wife, so resizing images is not a fantastic option for her. Other suggestions would be appreciated.

    Maybe this is a dumb question, but is there a way to call a local script or software on my home PC that will auto resize before it gets uploaded?

  6. kevmac27
    Member
    Posted 4 years ago #

    I did find this piece of software that seems to work pretty good. I can preset images sizes and all she has to do is drag and drop the images. Works pretty well from what I can tell:

    http://toki-woki.net/p/Shrink-O-Matic/

    Much better than trying to teach her photoshop!

Topic Closed

This topic has been closed to new replies.

About this Topic