WordPress

[WordPress on VPS] 3 Ways to Increase the Maximum File Upload Size

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' );

PHP.ini File

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.

.htaccess File

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.

edge

Share
Published by
edge
Tags: VPSWordPress

Recent Posts

Disable Copilot on Windows 11 via Group Policy GPO

If using Copilot right from the Taskbar isn't your thing, you should disable it. Even…

3 weeks ago

Setting Default Fonts in Word, Excel, Outlook, and PowerPoint via Group Policy

In an environment where standardizing things does matter, setting default fonts in Microsoft Office apps…

1 month ago

Wake-On-LAN (WOL) with Windows and PowerShell

Wake-On-LAN is a networking standard that lets you wake up a computer from either a…

2 months ago

How To Remove Restrictions Set in A Password-Protected PDF File

First of all, this is not to bypass a PDF file that requires a password…

2 months ago

How To Move My Outlook Navigation Bar Back From Left Back To the Bottom

Microsoft has been lurking about the idea of placing the Outlook navigation bar to the…

1 year ago

Headset with Microphone Echoing My Own Voice on Windows, What To Do?

One colleague came up to me the other day asking me to take look at…

1 year ago