Reputation: 111
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?
Upvotes: 4
Views: 6608
Reputation: 2478
I know it's an old post, but for any future Googlers, it's a very little known fact, but there are some settings that can not be overridden by ini_set()
. The upload_max_filesize
and post_max_size
are 2 of those settings. A long list of the "directives" is described in the docs, and where each directive can be set.
Both these settings describe they are changeable in what they call "INI_PERDIR
". From the docs ini mode constants page:
INI_PERDIR
Entry can be set in php.ini, .htaccess, httpd.conf or .user.ini
So the upload_max_filesize
and post_max_size
can only be set within one of these configuration files.
Upvotes: 0
Reputation: 156
In case you're using multisite keep in mind that there is a max_upload_filesize setting for the network.
Upvotes: 2
Reputation: 2500
This was absolute insanity. I almost went crazy looking for a solution.
My wp-admin/php.ini
was getting completely ignored.
I changed /etc/apache2/php/7.4/cli/php.ini
, still nothing, it was getting ignored.
Turns out it was getting settings from /etc/php/7.4/apache2/php.ini
.
Upvotes: 4
Reputation: 53
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.
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.
Upvotes: 5
Reputation: 407
There are a lot of people having this problem the best way to fix it is by creating a new php.ini inside your wp-admin folder.
1.Connect to your site via FTP or File Manager 2.Navigate to wp-admin folder 3.Create a file inside the wp-admin folder called php.ini 4.Add in this line: max_input_vars = 5000 5.Save
I wrote a quick blog article on it here too: Increasing Your Max_input_vars Value
Upvotes: 4
Reputation: 1049
There are many ways to achieve what you need , here are three ways you can use any one of these
1) Using functions file: Copy and paste the code below to functions.php file
@ini_set( 'upload_max_filesize' , '50M' );
@ini_set( 'post_max_size', '50M');
@ini_set( 'max_execution_time', '300' );
2) Try using htaccess method by adding the code below:
php_value upload_max_filesize 50M
php_value post_max_size 50M
php_value max_execution_time 300
php_value max_input_time 300
3) Last method, php.ini file that you are already trying
upload_max_filesize = 50M
post_max_size = 50M
max_execution_time = 300
Hope it helps !
Upvotes: 4