For our WordPress clients, we use a plugin called Resize at Upload Plus to ensure that any images that are uploaded are immediately resized to a manageable size. Using a tool like this is a practical solution when you are concerned about overall server storage for a WordPress blog that will be utilizing a lot of images.
Recently we ran into an issue with the plugin that is caused by a default limitation in WordPress.
“Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 4000 bytes)”.
An error like this would obviously prevent any photo from being resized after upload, but it also prevents the photo from completing the upload process.
The cause of this error is a default setting in WordPress. By default WP installs with a default memory limit of 32M. This is the maximum amount of memory that can be used by PHP. Some web hosts will pre-set this limit to something really low (like 8M) and some will not let you change this. However, in this case, if your web host allows you to change this here’s what you’ll need to do to increase this limit and avoid this fatal error:
- Open wp_settings.php and search for “WP_MEMORY_LIMIT’. This will most likely be at the start of the file around line 13.
- Change the default number for the memory amount allocated for PHP. I recommend 64M or 96M. In some cases you may just need to increase the limit slightly, but for WordPress sites that use a lot of plugins, you’ll want to increase this level more since there will be more of the PHP plugins that will be using that limit.
- Save the file and upload to your site.
- Try uploading the files again to see if this has solved the error.