KB ID 0001335
Problem
Quite a few times after I rebuilt my server, (and WordPress site), I saw the following when uploading images etc.
HTTP Error
Solution
I was quite sure everything was setup OK, I had set the max file upload limits set, but it turns out I needed to add a ‘memory limit’ in my wp-config.php file before the error ceased. For completeness I’ll include the other usual suspects, in case yours is setup a little differently from mine.
Edit Your php.ini File
Note: If you are running an earlier version of php, your path may be different.
[box]
sudo nano /etc/php/7.0/fpm/php.ini
[/box]
Ensure the following has been set;
[box]
upload_max_filesize = 50M max_file_uploads = 20 post_max_size = 50M
[/box]
Edit Your nginx.conf File
(Obviously don’t do this if you are running Apache!)
[box]
sudo nano /etc/nginx/nginx.conf
[/box]
In the very bottom of the http section, (before the end ‘curly’ bracket ‘}’), add in the following;
[box]
client_max_body_size 100m;
[/box]
Edit Your wp-config.php File
[box]
sudo nano /var/www/html/wp-config.php
[/box]
Add the following to the very bottom of the file;
[box]
define('WP_MEMORY_LIMIT', '120MB');
[/box]
Related Articles, References, Credits, or External Links
NA