I installed the wordpress several days ago, when I try to upload a featured image, it tell me that the max upload size is 2M, I updated the nginx setting, but php seems not get the value from nginx. I also searched the internet, and there are some suggestions, but it still does not work in my case, I described how I solved the problem in this article.
I searched the internet, and they said to added the following line to
wp-config.php, but it does not work on my server.
@ini_set( 'upload_max_size' , '64M' ); @ini_set( 'post_max_size', '64M'); @ini_set( 'max_execution_time', '300' );
Or added a php.ini file with the following content under wordpress root folder, but it also does not work on my server.
upload_max_filesize = 64M post_max_size = 128M
My solution is find the
upload on wordpress source code, and find a function
wp-includes/media.php, and find that it gets the max upload size with the following code:
ini_get( 'upload_max_filesize' )
php.ini file is location is
/etc/php.ini, I find that the wordpress get the setting from this file, and after I update the upload_max_filesize on the
/etc/php.ini and restart the
php-fpm service, it works.
Also need to update
post_max_size, the default of this value on
php.ini is 8M.