My problem:
I've now spent many days trying to fix an image upload problem. I have searched high and low, so now it is time to post. I hope I chose the right forum.

I have image and img_assist modules installed. All modules loaded are listed below.

While trying to upload a 2.2 MB image, I get these errors from a couple of computers:

* Fatal error: Allowed memory size of 25165824 bytes exhausted (tried to allocate 14208 bytes) in /home/suzan24k/www/includes/image.inc on line 288

increased php memory from 24 MB to 32 MB and got this next message.

* Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 10368 bytes) in /home/suzan24k/www/includes/image.inc on line 288

I have deleted almost all unused modules I had. I can upload images up to 1 MB successfully from computers having slower upload speeds. Not sure if slower upload speeds cause my image upload problem but it is the only common denominator I can see.

I have a PHP file upload max size of 20 MB.

Here are some test runs:

1. I am have been able to upload large image files up to 4MB from my desktop which is connected via wired cable to my cable internet service.
2. My father’s desktop computer which is also wired (in his home in another city) using DSL internet cannot upload photo images larger than about 1MB.
3. My wireless laptop at home with desktop in #1 fails trying to upload a 2.2 MB file.

What I want to understand is if somehow more memory is being used is by slower upload speeds.

I have a family web site set up with rarely more than three users logged in at a time.

Here’s what I have installed:

Drupal 4.7.3
php 4.4.0
MySQL 4.0.23

Enabled/Disabled loaded modules
1. archive
2. block
3. blogapi (will probably remove)
4. chatbox
5. chatroom
6. comment
7. contact
8. contact_list
9. event
10. filter
11. flexinode
12. forum
13. front_page
14. help (off)
15. image v 1.197.2.2
16. image_attach
17. image_gallery
18. img_assist v 1.56.2.6
19. locale
20. menu
21. node
22. page
23. poll
24. profile
25. search
26. search404
27. statistics
28. story (off)
29. system
30. taxonomy
31. throttle
32. tracker
33. upload
34. user
35. video
36. video_customfields (off)
37. video_image (off)
38. video_multidownload (off)
39. video_optmetadata (off)
40. video_params (off)
41. video_upload
42. watchdog

Conclusion:
I tried to include most of what I thought would be asked. :-)

Please let me know if you can think of anything esle to try. My next step was to continue to remove loaded modules I'm not using, but then I don't see how that will fix a problem that does not occur on my desktop.

Also on my list, I will be figuring out how to set up cron to delete temp directories.

Thank you and much appreciation for any new things to try.

--Suzan

Comments

Steven’s picture

Your numbers don't seem to add up. Your image is 2.2MB, but the following error show PHP using 20-30MB of memory:

* Fatal error: Allowed memory size of <strong>25165824</strong> bytes exhausted (tried to allocate 14208 bytes) in /home/suzan24k/www/includes/image.inc on line 288
* Fatal error: Allowed memory size of <strong>33554432</strong> bytes exhausted (tried to allocate 10368 bytes) in /home/suzan24k/www/includes/image.inc on line 288

Perhaps you have a buggy version of PHP or Apache, but this is definitely not normal.

--
If you have a problem, please search before posting a question.

suzan24k’s picture

I agree the image size is much smaller than the memory allocated to PHP, but I've been reading that other modules and processes also use resources so I have increased the PHP memory to 32MB. Not sure I see how PHP or Apache affects only certain computers, but you did give me a couple things to try, like turning off the chatbox and Who's Online.

All, please keep the ideas coming.

Suzan

harry slaughter’s picture

try setting the upload_max_filesize and memory_limit vars in php.ini to something more suited to your needs.

--
Drupal tips, tricks and services
http://devbee.com/ - Effective Drupal

--
Devbee - http://devbee.net/

suzan24k’s picture

Changing php.ini settings has already been done, but again, I don't see how only certain user computers can't upload. I will continue to review the settings though and let you know if that helped.

Much appreciation.

Suzan

vm’s picture

because people on slower connections send information slower and run a higher risk of timing out. increase post max size

suzan24k’s picture

Currently, my post_max_size is 24MB ( php_value post_max_size 24M). I changed it to 40MB which it has been before and still I get the same out of memory error. How high should I set this? The 2.2 MB image upload testing uploading from my wireless laptop is still failing.

Thank you for this and any other ideas.

Suzan

suzan24k’s picture

I wanted to add a few discoveries.

1. During one of the 2.2 MB failed tests, my image managed to upload to the files/images/temp directory and had a thumbnail created in the directory also, but did NOT get a preview image built so I think the code failed while trying to build a preview image.

2. Line 225 seems to now be failing and here is what is in the image.inc line 225:

$res = imageCreateTrueColor($width, $height); # line 225

3.Previously out of memory test showed line 288 as failing in the same image.inc code:

function image_gd_open($file, $extension) {
$extension = str_replace('jpg', 'jpeg', $extension);
$open_func = 'imageCreateFrom'. $extension;
if (!function_exists($open_func)) {
return false;
}
return $open_func($file); # line 288
}

Do you think I should post over in the image module issues logs?

Gratefully appreciative,

--Suzan

suzan24k’s picture

Ok, so while on one hand I wanted another solution and I still don't understand completely why with 32MB of PHP memory some computers can upload while others cannot, I went with increasing the PHP memory to 64MB and found that all problem computers can now upload. I just didn't want to use that much php memory, but I guess there comes a time when you got to go with bigger guns.

Hope this this may some day help someone else.

Suzan

Mojah’s picture

I noticed that an image with a 2048x1536 size, file size of 536kb caused the same error. However when I reduced the size of the image to around 800x600 and exported it as a high quality jpeg from my image (635kb) editing program, I did not get the error message. My php mem_limit was 20M. It appears that more memory was somehow used by the larger dimensioned image.

Somethings that may help others experiencing this problem...

Use your .htaccess file to test out different php settings before setting it within your php.ini file. If Apache is set to use .htaccess, it will look for this file whenever a page is called. By tweaking the settings in .htaccess, you won't have to keep restarting Apache to see of a setting works.

Here's what I have in my .htaccess file


php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value max_execution_time 600
php_value memory_limit 32M

Love, Live, Laugh

mak123’s picture

I am getting the following error when i upload the image into to the server.

Fatal error: Allowed memory size of 25165824 bytes exhausted (tried to allocate 8000 bytes) in /hsphere/local/home/kannan/tamilulagamnews.com/testing2/admin/photo_gallery/admin/create_gallery.php on line 22

The same code works fine in my local server and online testing server. the images are uploading fine, no error has come. wherease when i moved the site into live server, and when i test this page i am getting the error.

this is my server configuration
--------------------------------------
memory_limit 24M
post_max_size 20M

I am just uploading small size file only, the image gets upload into the server but i am getting the error after the image is upload,

any one know how to resolve this issue.

help is much appreciated.

Thanks in advance.

vm’s picture

increase the amount of memory your server allows php to use. There are methods outlined in the documentation / Troubleshooting FAQ's area as well as this thead.