Wordpress - How to Fix HTTP Error When Uploading Images?

I put the following code into my functions.php file. It works!

add_filter( 'wp_image_editors', 'change_graphic_lib' );

function change_graphic_lib($array) {
  return array( 'WP_Image_Editor_GD', 'WP_Image_Editor_Imagick' );
}

When this helps it is because it changes the PHP code module used for processing the uploaded image for use with WordPress.

This processing includes moving the image into the media library database and generating the different size images ("thumbnail", "medium", "large") that WordPress always wants available for themes to access.

It causes the "GD" module to be used, because it is first. In some server setups, the newer "Imagick" library isn't playing well with others for certain image scenarios, such as large pixel dimensions, so forcing the "GD" library to be used is a fix.


After troubleshooting with @Wyck in chat, we have narrowed to the underlying issue.

The issue was related to my server configuration not having the proper amount of memory allocated to Apache/PHP.

If anyone has this same problem, please try verifying that you have enough (64 MB+) server memory allocated to Apache/PHP in your server configuration settings. You can also add this to your wp-config.php file:

define('WP_MEMORY_LIMIT', '64MB');

If the above solution does not work, read the article Image/Media Uploader problems? for further troubleshooting.

Try adding one by one or all of the following .htaccess tweaks to the .htaccess file in the root directory of your WordPress installation.

Seriously, try one of each of the solutions below so you know which one did the trick. Don't just paste them all in your .htaccess file immediately.

Try this line:

AddType x-mapp-php5 .php

mod_security might be causing problems. Disable it to see if that is the problem. To do this, make an .htaccess file in your wp-admin directory. Add this to it:

<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

If you're using access control based on authentication on your Webserver (often known as htpasswd, basic authentication, password protected directory or similar), WordPress is not able to handle it for Flash Uploader, Cron, and XMLRPC. Related files need to be excluded to work. Keep in mind that this might break your security considerations.

# Exclude the file upload and WordPress CRON scripts from authentication
<FilesMatch "(async-upload\.php|wp-cron\.php|xmlrpc\.php)$">
    Satisfy Any
    Order allow,deny
    Allow from all
    Deny from none
</FilesMatch>

One final note: some have said that if using a lesser version of PHP 5.3.X you can try disabling PHP Safe Mode.

If you are running WordPress multi-site and are receiving HTTP errors or internal server errors, related to image uploading, please read Uploading Images to Multi-Site Causes Failure to HTTP Error) for other possible troubleshooting ideas and solutions.


I ran into the same error, when trying to upload media in wordpress. In Chrome, it shows up as a http: error; in Firefox, the error looks quite different. The web is full stories of people who have spent days to chase the bug (so have I :-( ). Solutions abound, but nobody explains why, at least not in a way that is consistent with the symptoms.

My tuppence worthy contribution: I noticed that the problem correlates with a segmentation fault signalled in the log file of apache2. That disturbs me, because it is difficult to diagnose.

Rebooting the entire server took away all symptoms and all of a sudden I could upload media again in Wordpress. Frustratingly, I have no clue as to why this occurs. The reboot effectively stopped me from any further research, and I will now have to wait (weeks? months?) for the problem to reappear. I hope this will help others in their quest for the cause of this problem. My wife is happy, though, because I can no longer spend nights chasing this problem...