How To Solve The WordPress Image Upload Http Error

How To Solve The WordPress Image Upload Http Error

This post aims to help solve the increasingly common error that occurs when users upload images to their WordPress Media Library. The process to overcome this issue is extremely frustrating and could be quite consuming. Support forums of WordPress, your hosting company, and your theme supplier are often good places to start. By looking at questions/tickets that others have posted and more importantly the answers given by tech support team and volunteers, you may get some clues to find the possible cause of your site’s problem.

Some Common Solutions:

I. Increase the PHP Upload Limit In Your PHP.INI File

This solution works when your error is related to memory limit issues. You may also refer to this GoDaddy Support article if your site is hosted by GoDaddy.

1. To start, first download a copy of your current php.ini file from the ROOT folder of your site’s FTP. Create a file and name it “php.ini” if there isn’t already such a file in your site’s root folder.

2. What you will want to do next is to insert the following lines into the php.ini document. Replace the max-size figures with a desired number, for example 120M (Note that 64M is the minimum memory allowance required for the media uploads to work correctly according to some users).

file_uploads = On

post_max_size = 100M

upload_max_filesize = 100M

Alternatively, if you can find the above lines in the existing php.ini file, replace the current figure with a higher number.

3. To verify that your change has actually taken effect, open your WordPress site’s Media Uploader Page and see if the Maximum upload file size figure is updated. If you are unable to see the update figure, you should contact your hosting provider to request a check up on your current memory limit. You also need to ask your hosting provider to give a solution that will increase your uploads maximum sizes as this is an issue on your hosting provider’s end.

4. Upload an image in your media library to see if the error is fixed. If the same issue persists, allows up to 24 hours for the site to be updated thoroughly. You may also look into other possible solutions.

II. Fix Your .htaccess File

Create a .htaccess file if you do not already have one in your Root WordPress folder. You can have WordPress do this for you by going into the Permalinks Setting page of your WordPress site, select one of the permalinks options, and click save. This will prompt WordPress to automatically create a .htaccess file in your root directory. Refresh the FTP client to download file.

Make sure that you keep a backup version of the original .htaccess file.

Add the following chunks of codes to the file one by one (before the “#End” line within the file). Note that each chunk is  used for a slightly different purpose, and it’s best that you monitor the changes closely to self-diagnose the cause of your site’s error.

….

<IfModule mod_security.c>

<Files async-upload.php>

SecFilterEngine Off

SecFilterScanPOST Off

</Files>

</IfModule>

Turns mod_sec off on the async-upload.php file.

….

SecFilterEngine Off

What my sites (I have multiple WP sites within the root folder)’ .htaccess file looks like:

III. Change Folder Permission:

How to determine if you should pursuit this solution:

1. Log into your website’s FTP. You may do so by either using the FTP platform offered by your hosting provider or download an ftp client like FIlezilla.

2.Are you able to access wp-content folder/uploads/2014/03 (replace the month and year in the string with the time that your image was uploaded) as shown in the image below?

3.If you can access the folder where your latest media are uploaded, then the HTTP error is not caused by a folder permission problem.

4.If you are unable to do so, here are a few steps that might help:

 

Make sure that your wp-content directory is writable by the server

Log into your FTP client (e.g. Filezilla), access the root folder of your site, right click on the wp-content folder/directory, and click File permissions.

 

In the pop up window, check boxes as shown in the image below then click OK.

 

In some cases, you may need to check all the boxes in this pop-up window, which in turn generates a Numeric value of 777. This has resolved the issue for some users, but take note that it is a rather dangerous action as it will allow ANY party on the web to write on your wp-content directory.

Enable Month- and Year- Based Folders in WordPress Dashboard

Open the Media Settings page in your WordPress dashboard and check the box for “Organize my uploads into mont- and year- based folders.

 

Upload Another Media File to Media Library. It worked? Hooray!

Nah, the Http Error Still Occurs…

Try This: Change the ownership of the site to Apache: sudo chown -R apache:apache /var/www/html/site_name/

VI. This May Be ACL Issue

(If you cannot find the aforesaid directories after after the above steps)

Unfortunately (but fortunately for me) I have not yet encountered this issue myself, so I’ll quote a WordPress user’s proposed solution here:

…………………………………………………………………………………………………………………………………………………………..

From user peter.beniaris:

It’s actually an acl issue and not a permissions issue as you would first suspect. You have to set the acl option on the file system hosting your web server, and do it in the /etc/fstab file so it will survive reboots. The line in my /etc/fstab looks like:

UUID=397966d0-61eb-4ef4-8ffd-10b6c06964dd / ext4 defaults,acl 1 1

Next, remount the file system as follows for acl’s to take effect:

mount -o remount /

Next, set an acl on the parent directory for uploads. In my case, it’s as follows:

setfacl -R -m u:apache:rwx /var/www/html

Next, check to make sure that ‘apache’ has rwx access to the directory:

getfacl /var/www/html

You will see an entry displaying that ‘apache’ now has access for that directory, and it will look like the following in the output:

user:apache:rwx

Now, you can go into WordPress, and all should be well.

…………………………………………………………………………………………………………………………………………………………..

V. Disable Fast CGI For PHP Extensions

A GoDaddy user reported that by disabling FastCGI for PHP extensions, their http error has gone away. Contact your hosting provider to check if Fast CGI is enabled for your PHP extensions and ask them to disable it for you if possible. Note: You can no longer follow the instruction provided in the screenshot to access the PHP file extensions setting page on GoDaddy, which is why you should contact your hosting company directly to ask for specific instructions.

VI. Hosting Provider Install Script Fixes

If your WordPress site was installed as an application through your hosting provider, such as GoDaddy, there is a chance that your error is caused by the install script used by your hosting company. While most of the time the hosting provider would say it is not their fault, they might still be responsible for hassles that you are experiencing. A user (MaineAtheist) shared that a GoDaddy’s tech support told him/her, “(GoDaddy’s) install script had an extra line break where there wasn’t supposed to be”.

Use this as an example and urge your hosting provider to check thoroughly on their ends. Just in case.

VII. WHITELIST ^Shockwave Flash

For some, having their hosting company Whitelist ^Shockwave Flash in mod_security provides a simple fix. Your hosting company should know what this is asking them to do without too much of explaining. But incase you are interested in learning more

 

 

About The Author

Related posts

4 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *