• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Attachment Upload Fails Sometimes


Active member
I've been trying to attach pngs to my messages, but there are some pngs that won't upload. The bar gets stuck at 100%. They are all different dimensions and sizes, and I don't notice anything consistent about the ones that don't work. Here is the error that is showing up in the console in Google Chrome.

Invalid JSON: <br/> <b>Fatal error</b>: Allowed memory size of 134217728 bytes exhausted (tried to allocate 8000 bytes) in <b>/home/owls8521/explodingrabbit.com/forum/library/XenForo/Image/Gd.php</b> on line <b>77</b><br/>

Digital Doctor

Well-known member
You are out of memory.
Reset the server and see if it goes away ... if it doesn't things look harder from there.
Some of these troubles might stem from the hackers :)


Active member
I rebooted the server and the problem still persists. So there is something wrong with my server? I guess I'll contact customer support for Dreamhost.

Digital Doctor

Well-known member
Are you able to increase the size of the memory .... or shut down some processes ?
The host might be able to give you some more information about what is eating up the memory.


Active member
The memory problem only happens when I upload certain png files. Otherwise it seems fine. I have graphs that show me the memory and it is well below the limits.

Digital Doctor

Well-known member

You can also make this change permanently for all PHP scripts running on the server by adding a line like this to the server’s php.ini file:
memory_limit = 12M

of course that is too low for you ... you are running out at 134217728 bytes
memory_limit = 160M might work .... but that sure seems like alot.
This is a common problem that is for sure. [link].

Digital Doctor

Well-known member
in Gd.php on line 77 .. see if there is something in there that restricts memory to a certain size.

This might help:

Try this first:

Make sure debug mode is off. Remove the debug line from the library/config.php file if you previously added it.

If you still get the error then you need to ask your host to increase or disable PHP's memory_limit.

You can also try changing the memory_limit yourself. These methods don't always work, but try adding this to your library/config.php file:

Digital Doctor

Well-known member
XF sets the memory limit to 128M itself. You can set it in config.php:
ini_set('memory_limit', 256 * 1024 * 1024)

167772160 = 160 Megs.

ini_set('memory_limit', 160 * 1024 * 1024) or
ini_set('memory_limit', 167772160)



Active member
Yeah I saw that. I think it's happening because it's trying to create thumbnails for really big images and I guess that takes up a lot of memory. I'll just set a limit on the dimensions people can upload. I was trying to upload an image that was 8000 x 8000 pixels. I didn't know that uploading a higher resolution image used up more memory than a smaller one. I thought only the file size mattered.

Thanks for your help, Digital Doctor. I learned a lot.