So, lately I've been occasionally bugged by an HTTP error when uploading images. At first I didn't think much of it, I thought there was something wrong with the image file, so I ran it through FastStone Photo Resizer (a program I use to compress/resize most images I upload) and that fixed the problem. Many days passed.
Then today I was about to post about a new pair of shoes and the error popped up in a red box. I had already resized the picture, and sizewise it was down at 418kb, so there should be no problem with the file. I tried uploading a few times, and each time it got stuck at 92%. I tried uploading the original file (around 2MB) and it got stuck at 99%. At this point I was thinking there was some problem at the end of the file (EXIF camera information maybe?) since I hadn't uploaded a photo in a while, but then I tried making the file a LOT smaller (10%), and it uploaded fine!
I checked support threads and people spoke about the Smushit plugin giving the same error, but I don't have that plugin installed (no sense in resizing the image after upload, I do that before uploading). I checked my plugins anyway, to see if any of them were suspicious, and then I checked my error_log. Guess what, exhausted memory limit was the error. I found a bunch of other plugins misbehaving too, but that's outside the post, the exhausted memory limit was easy to fix, and I'm surprised I haven't 'fixed' it earlier! Maybe my host didn't allow modification of the PHP RAM limit earlier. Anyway, the fix is this:
define('WP_MEMORY_LIMIT', '32M');
Just add that to the wp-config.php file. That's it. You could change the .htacess file or the php.ini file too, it'll do the same thing. I tried uploading again after this quick edit and the error was swept away. I might be imagining things, but I feel like the site overall is a bit faster too. Maybe this will even get rid of those occasional pesky 502 errors that sometimes bother me! Maybe this tip is useful for some other lost soul looking to fix their HTTP errors. If you didn't know it, now you know. :)
Comments
This was pretty damn interesting. And yet, nobody's spoken! Be the first!
© CyberD.org 2024
Keeping the world since 2004.
The Comment Form