Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WordPress ignoring php.ini upload max file size

Tags:

php

wordpress

I'm running a WordPress site (not MU), I have set upload_max_filesize = 50M, post_max_size=50M in php.ini. The results of phpinfo() function show the value to be 50M but in WordPress Media uploader Max upload file size is still 32M.

I have also tried to write this code in the theme's functions.php:

@ini_set( 'upload_max_size' , '50M' );
@ini_set( 'post_max_size', '50M');

Also tried deactivating all plugins, changed theme but no resort, WordPress still says 32 Mb.

Can anyone guide me what can be wrong here?

like image 367
Pramod Jodhani Avatar asked Oct 15 '25 15:10

Pramod Jodhani


1 Answers

I had the same problem, and the other answers didn't completely work for me, and I'm apparently not alone, so here's what I did to make it work.

  1. Locate your php.ini files: sudo find / -name "php*.ini" -print. This will give you an idea of where any configuration files might be hiding.
  2. Open them one at a time (you may need sudo).
  3. Check to see if they have a line "upload_max_filesize=##" where ## is some value (i.e. 250M). You shouldn't have to add any of the lines. This should already be in the file.
  4. You will need to change the line "post_max_size=##" to be greater than or equal to upload_max_filesize.

Notes:

Supposedly, you can do "php -i | grep php.ini" to see which configuration file is being used, but changing the indicated file did not work for me. I changed one that lived at /etc/php5/apache2/php.ini to make it work. Some trial and error will be needed, but give this a shot.

like image 130
soonertiger2012 Avatar answered Oct 18 '25 07:10

soonertiger2012



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!