HTTP error when uploading an image to WordPress is one of most frustrating error for non-tech WordPress users.
Especially, when all you was trying to do is to create content for your blog or building your website and You have no idea why you are getting http errors.
I personally know it’s damn annoying thing.
Lucky for you, i have a solid solution for this problem.
Why are you getting HTTP error at first place?
Well, It can be happen because of many reasons but 99.9% of time it’s because you don’t have sufficent PHP memory.
Other 0.1% of time one of your untested plugin or php code you added in your site manually gone rouge and using all php memory.
what is PHP memory?
PHP memory is the limit a single process(like you trying to upload a image, or visitor click something on webpage is allowed to use.
The job of this PHP process is to generate some HTML to throw back at the visitor or what ever you ask to server, it delivers via PHP process – the PHP process provides a run time to a PHP script that should be doing that.
Why you getting HTTP error than?
I was hoping tou get the the idea why this happens, It’s okay let me repeat…
PHP memory limit is the maximum amount of memory a single process or in simple languagr a Task can use. If you exceed it, the process fails and Server reports an HTTP 500 error.
How can I fix http error than?
All you have to do now is Increase the limit and if that doesn’t solve the problem we need to find the rotten WordPress plugin.
To find a plugin with problem you have to disable all the plugins and then activate one by one until you find the culprit.
How to increase php memory limit
There are number of ways to increase the PHP limit.
Sometimes you can do this in your hosting Dashboard if you are using managed WordPress hosting such as Cloudways or Kinsta.
Most straight forward way is editing your wp-config.php file for that:
- You need to have access File manager via CPanel or access to FTP.
- Go to your website’s root folder and found the file in root directory called wp-config.php.
- Right click on the file and choose option ” view/edit file” .
Paste the code below at very bottom of the file
define( 'WP_MEMORY_LIMIT', '256M' );
You should not use more than 256 MB for normal WordPress website in any case. You could try just 128M only just to be on safe side.
If you are already wondering to you use more memory than. STOP
PHP memory limit should be set as low as possible like 128 Mb may be or with in the bounds of what you need.
The memory limit is applied to each individual concurrently executing script, not globally. Setting it low will help ensure that if you make some mistake that causes e.g. an infinite loop, the script will be stop early rather than spiralling out of control and grinding the entire server to a halt.
Some more ways to increase PHP memory limit
You can also try increasing your memory by adding the following in your .htaccess file. This will only work if your hosting package has that amount of memory. Increase gradually until you are able to upload an image size which is acceptable by you.
Note: Some web hosting does not allow this and you probably get “500 internal server error”. In this case you will have to remove this code.
php_value memory_limit 256M
If you have code-phobia or new to WordPress. simply, ask your hosting comapany to do it for you.
In some cases it can be just Plugin conflict
- You may have installed a plugin that’s causing this issue. Please proceed to disable one plugin at a time. Clear your cache and browser history and revisit media up loader to upload your image ( keep the pixel size small ) and see if you are successful.
Does it solve your problem? let me know if any question or facing any issue please leave a comment below.