Fix WordPress HTTP error
HTTP error can be really frustrating while uploading images to WordPress. There are many things that can cause this error.
Let’s take a look at these issues and the ways to solve them.
1. Image Size
- Large images can trigger this issue. what we can do here is decrease the size of images to check if the issues resolved or not.
The image size of 1170×660 is more than enough for most post content area.
- Unless you really need to add larger size images to WordPress, try to use smaller size images.
- Large images also slow down the loading of WordPress pages. If you still need to upload Large images to WordPress then you need to increase PHP memory.
- Also, change the Image file extensions from .png to .jpg to check if the issue still occurs or not.
- Image names can also cause this issue, Don’t use special characters like the apostrophe in image names.
2. File exceeds the upload_max_filesize
The last time I had to deal with HTTP error issue was because of this reason.
If you receive the error like File exceeds the upload_max_filesize than it means the PHP Upload Max Filesize or upload_max_filesize variable set in your php.ini file is smaller than the file size of the image that you are trying to upload.
To solve this issue you need to increase the PHP upload_max_filesize to a higher value.
So take a backup of your existing php.ini file first and then take a look at these values:
upload_max_filesize post_max_size max_execution_time max_input_time memory_limit
Also, try to change these variables to these values.
upload_max_filesize 64M post_max_size 64M max_execution_time 300 max_input_time 300
You can also tweak memory_limit if you have enough memory. For example, if you have more than 1GB or more memory than you can edit,
memory_limit = 256M
If you can’t access this file ( Shared Hosting ) then you better contact your hosting company.
3. PHP version
If you’re using an older version of PHP most likely 5.2 than you may encounter this issue. PHP 5.2 has reached End Of Life. PHP 5.6 or 7 is the best version to use with WordPress.
Try to deactivate WordPress plugins to check whether this issue is caused by plugins or not. If yes, then find and deactivate that plugin.
5. Dealing with Cpanel
If you’re simply unable to upload a file to your site, then you may need to edit the .htaccess file to solve this issue.
- Log into your cPanel dashboard.
- Go to file manager –> WordPress site’s root directory usually /home/user/public_html/.
- Locate and open the .htaccess file and add the following line at the top of the file:
SetEnv MAGICK_THREAD_LIMIT 1
- Save these changes to the .htaccess file.
Now you should be able to upload the image to your WordPress site without any issue.
These are the few things that you can try to solve HTTP error on WordPress.
If you think I have missed some things then please let me know via comment or mail.
If you found this post useful, I’d be very grateful if you’d help it spread by emailing it to a friend or sharing it on Twitter or Facebook.
Thank you! Have a Great day. 🙂