WordPress: The server cannot process the image — How To Fix?

The server cannot process the image. This can happen if the server is busy or does not have enough resources to complete the task. Uploading a smaller image may help. Suggested maximum size is 2560 pixels.

The above seen error swept a couple of hours out of my day. At the end, I’ve figured out what went wrong and I’m about to share how I fixed it.

Solution

  1. Find out which php.ini is loaded by running the following command.
php -i | grep 'php.ini'
# Result

Configuration File (php.ini) Path: /etc/php/7.x/cli
  1. Bump up the upload_max_filesize value. In my case, I bumped to 8M. I had to make this change in the /etc/php/7.4/fpm/php.ini file.
; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 8M
  1. Restart PHP FPM service by running the following command.
sudo systemctl restart php7.4-fpm.service

By now the maximum upload file size displayed in the WordPress dashboad must have been set to the value you set in the php.ini file.

Behind The Scenes

If you’re interested in knowing what I tried before I arrived at the above solution then keep reading.

  1. Since the issue is obvious and related to file uploads, I tried to increase the memory limit using `wp-config.php`. But this did not solve the problem.
define('WP_MEMORY_LIMIT', '256M');
define('WP_MAX_MEMORY_LIMIT', '512M');
  1. Next I tried changing the upload_max_filesize value in php.ini file. I’m running a LEMP stack. However, changing the php.ini file did not solve the problem.

The loaded php.ini can be found by running the following command.

php -i | grep 'php.ini'
# Result

Loaded Configuration File: /etc/php/7.4/cli/php.ini

I restarted the PHP service for the changes in php.ini file to take place using the following command.

sudo systemctl reload php7.4
  1. I disabled gd PHP module and installed imagemagick PHP module. However, this did not solve the problem.

You can run the following command to list all the installed PHP modules.

php -m

Today, I’m grateful to my two beautiful dogs who keep me sane by offering love licks when I’m busting through the roof.

Leave a Reply

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