HTTP error when uploading an image to WordPress is one of the most frustrating error for non-tech WordPress users.
- Why you are getting HTTP error
- What is the PHP memory
- How to fix the HTTP error?
- Increase php Memory limit
- Plugins Conflict
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, it’s pretty easy to fix this type of http error.
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 Limit?
The job of this PHP process is to generate some HTML to throw back at the visitor or whatever you command the server to do, 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?
PHP memory limit is the maximum amount of memory a single process, or in simple language, a Task can use.
If you exceed it, the process fails and Server reports an HTTP 500 error.
How can you 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' );
Please note, 256 in the above code is maximum php memory limit to process something on your server.
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.
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 a 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 stopped 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
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 a just Plugin conflict
You may have installed a plugin that’s causing this issue. Please proceed to disable one plugin at a time until you find the one which causing the issue.
Clear your cache and browser history and revisit media uploader 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.