简体   繁体   中英

WordPress ignoring php.ini upload max file size

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?

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 !

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 (ie 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.

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

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 .

In case you're using multisite keep in mind that there is a max_upload_filesize setting for the network.

WordPress 多站点设置

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM