The default value set up in PHP limits the maximum upload file size to 2 MB. Therefore, a new WordPress powered website in VPS will have the same limit that maximizes the upload file size to 2 MB, like below when you were trying to upload a file to Media Library.
So, how to increase this number so I can upload a much larger high-definition image file or video file to WordPress?
Here are 3 ways for you.
Theme Functions File
Open the functions.php file in your theme and add the following code:
@ini_set( 'upload_max_size' , '64M' ); @ini_set( 'post_max_size', '64M'); @ini_set( 'max_execution_time', '300' );
If you don’t see a php.ini file in the root folder of your site, create one and add the following codes to it.
upload_max_filesize = 64M post_max_size = 64M max_execution_time = 300
Note that if 64 MB doesn’t work, try something smaller, like 10 MB, and see if it works.
To make the change machine-wide, you may change the php.ini file under /etc/php/version/apache2/ folder.
Open or create the .htaccess file in the root folder of your website and add the following code, between the # Begin WordPress and # End WordPress section.
php_value upload_max_filesize 64M php_value post_max_size 64M php_value max_execution_time 300 php_value max_input_time 300
Depending on the hosting platform you are using, one of the three ways should lift the file upload size for your WordPress website. It seems that the .htaccess file always works for me on the sites hosted in a VPS environment.
After making these changes, you can go to Add new file in Media Library to double-check if the change is taking place.