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
- 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
- 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
- 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.
- 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');
- Next I tried changing the
upload_max_filesize
value inphp.ini
file. I’m running a LEMP stack. However, changing thephp.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
- I disabled
gd
PHP module and installedimagemagick
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