简体   繁体   中英

Max upload size is limited to 10 MB on a local Wordpress installation

I have a local Wordpress installation at my work place using Wamp, and I had a max upload size of 3 MB.
Following the solution I found, I edited the php.ini file from the wamp menu, increased post_max_size to 32M and upload_max_filesize to 64M and restarted the servers.

The max upload size increased in the Wordpress admin area to 10 MB, which isn't enough, and I can't tell where that number is coming from.

I searched for the phrase 10M in the wamp's php.ini file but didn't find any.

Any idea where that number might be coming from?

Quote from the PHP manual

post_max_size integer

Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize. If memory limit is enabled by your configure script, memory_limit also affects file uploading. Generally speaking, memory_limit should be larger than post_max_size. When an integer is used, the value is measured in bytes. Shorthand notation, as described in this FAQ, may also be used. If the size of post data is greater than post_max_size, the $_POST and $_FILES superglobals are empty. This can be tracked in various ways, eg by passing the $_GET variable to the script processing the data, ie , and then checking if $_GET['processed'] is set.

So your post_max_filesize need to be large enough to cope with the

(upload_max_filesize * files uploaded) + other variables 

Also you need to check that memory_limit is big enough to cope as well

The correct php.ini file

It is also worth noting that WAMPServer, like most Apache/PHP installations has 2 different php.ini files. Maybe you are editng the wrong one?

There is one in \\wamp\\bin\\php\\php{version}\\php.ini this is used by the PHP CLI ( Command Line Inteface ) and soes not affect PHP used under Apache.

The one you need to edit to affect Apache/PHP is \\wamp\\bin\\apache\\apache{version}\\bin\\php.ini but the easiest way to do that is to use the wampmanager menus.

Find the wampmanager icon in the system tray and left click then follow the menus

wampmanager -> PHP -> php.ini

This will open the correct php.ini file, the one used by PHP when run with apache. Make the changes in this file.

Create a .htaccess file into the WordPress root and insert the following:

php_value post_max_size 64MB
php_value post_max_filesize 64MB
php_value upload_max_filesize 64MB

Then check if the values have been changed inside wp-admin . If they have, there is some other php.ini being loaded instead of the one you've been editing.

Still ran into this problem today. Fix that worked for me:

Click WAMP tray icon and select PHP/php.ini

This will open the php.ini file in the editor you chose when installing WAMP. Note that php.ini is a shortcut to the file C:\\wampDir\\bin\\php\\php7.2.14\\phpForApache.ini. Presumably this will vary between installs.

What I found was that the upload max in WP is the lesser of these 2 settings in the php.ini file:

upload_max_filesize = 50M

and

post_max  = 45M

Easy! (after over an hour of searching) ;(

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