Can't upload images (incorrect "file exceeds upload_max_filesize" error)

This is my first WordPress site. I've installed it on my Linux Ubuntu 16.04 remote server (which is in my house). I've got a LEMP stack installed on this server. When I try to upload images to my WordPress site, I get an error that says:

The uploaded file exceeds the upload_max_filesize directive in php.ini.

I changed every php.ini file I could find to have upload_max_filesize = 64M. In fact, the upload page for my WordPress site specifically says "Maximum upload file size: 64 MB." So, I know my changes have been implemented. However, no images will upload. Even images 2 MB.

Topic php.ini uploads Wordpress

Category Web


I solved this finally!

I had another .conf file in my fpm/pool.d directory that had upload_max_filesize value in it. I was diligently changing the value in this conf file in addition to the php.ini file.

php_admin_value[upload_max_filesize] = 64M #comment

I also had what I thought was a comment in the same line. I suspected this was the issue. Removed the #comment. Restarted php and nginx. Voila. I can now upload images!

Thanks for your help, Patel Jignesh!


Use any one option. More info:

1) wp-config.php

define('WP_MEMORY_LIMIT', '256M');

2) Theme Functions File

@ini_set( 'upload_max_size' , '64M' );
@ini_set( 'post_max_size', '64M');
@ini_set( 'max_execution_time', '300' );

3) Create or Edit an existing PHP.INI file

upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300

4) htaccess Method

php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.