WordPress says “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.” after uploading an oversized image, then apache promptly dies.
If you already checked memory limits in /var/www/html/.htaccess
:
php_value memory_limit 513M
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300
Made sure that override is set to true in Apache config vim /etc/apache2/apache2.conf
:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Then the problem could be 0 swap space. Check with:
free -h
If swap space is 0, add some with:
# 1. Create a 2GB file named 'swapfile' in the root directory
sudo fallocate -l 2G /swapfile
# 2. Set the correct permissions for the swap file (read/write only for root)
sudo chmod 600 /swapfile
# 3. Mark the file as swap space
sudo mkswap /swapfile
# 4. Enable the swap space immediately
sudo swapon /swapfile
# 5. Make the swap persistent across reboots by adding it to /etc/fstab
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
Now restart apache2 things should work:
sudo systemctl [start/reload/restart] apache2