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.

enter image description here


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
  • I changed 1) from '100M' to '256M'. For 2) I don't know where in the functions file to add the lines you gave (it is a very large file and I have no @ini_set lines in it, so not sure where to put them). For 3), I already had those lines in my php.ini file. For 4), doesn't that apply to Apache? I use Nginx. Also want to repeat that the upload file size appears to be correct (as shown in above pic), but my images are declined anyway. – ejwheelock Nov 13 '17 at 16:18
  • After edit in PHP.INI file restart the server or not? if not then it please restart the server. it's necessary. – Jignesh Patel Nov 14 '17 at 3:50
  • Yes, I've restarted the server. I've also restarted the php-fpm service and nginx service after every change. I still get the same error. – ejwheelock Nov 14 '17 at 11:54
  • i am search about for other solution but not find anyone. so you Contact of Web Hosting Support and ask to increase file size upload limit. – Jignesh Patel Nov 15 '17 at 3:58
  • Unfortunately, I am the web host, so I need to figure this out. :( – ejwheelock Nov 16 '17 at 1:13

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!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.