» » » How to increase the maximum file upload size in Multisite WordPress Network with WHM

How to increase the maximum file upload size in Multisite WordPress Network with WHM

posted in: WordPress

Today I have a request from the client to increase the maximum upload file size for WordPress Network. The server is WHM(WebHost Manager). I gonna share with you how to increase step by step. Let’s start.

 

Media Library in WordPress single site

The screenshot shows where we will set in this post.

 

WHM

What is WHM? WHM stands for WebHost Manager. WHM provides administrative control over your dedicated server or VPS. You can manage the server and host your client’s website through WHM.

 

Multisite WordPress Network

What is Multisite WordPress Network? Multisite is a WordPress feature which allows users to create a network of sites on a single WordPress installation. For more detail, you can check from here: Create A Network

 

How we check the PHP setting before we change it

Here what we are looking for in the PHP setting:

  • memory_limit
  • post_max_size
  • upload_max_filesize

From the frontend, you can add this PHP code into your PHP file. This file will print out all PHP setting for your site. Beware this information can go publish if you forget to delete this code.

phpinfo();

 

How to set the PHP setting in WHM

To set the maximum upload size in WordPress involves with PHP setting on the server and in the WordPress. let’s do it.

  • We gonna set the PHP configuration on the server
    • Login to WHM
    • Click on the Account Information category in the left-hand side panel
    • Click on the List Accounts option
    • A list of the cPanels owned by the WHM user will appear.
    • Click the cPanel icon on the site you want to set the PHP configuration
    • Now, click on Service configuration then go to PHP configuration editor. You will see all PHP setting in basic mode.
    • Find “upload_max_filesize” and change to the size you want. For example, 10M
    • Next, you will need to set the “post_max_size”. You are in the basic mode. You need to change to the advanced mode in order to set the “post_max_size”.
    • In the advanced mode, set the “post_max_size” to be bigger than the “upload_max_filesize”. For example, 12M. If you set the “post_max_size” less than the “upload_max_filesize”, the maximum upload file size you can upload, will equal to or less than the “post_max_size” setting.
    • Next, you should set the memory limit in the advanced mode as well such as 32M. So that you won’t get any PHP memory warning.
    • After all the steps above, here what you set so far.
      • upload_max_filesize = 10M
      • post_max_size = 12M
      • memory_limit = 32M
    • At this point, if your WordPress is not the Network site, your site should be set the maximum upload size as you want now.

 

How to set the maximum upload size in the Network setting in WordPress

  • After PHP setting in WHM, we gonna set the PHP setting in Multisite WordPress Network
    • Login as super admin so that you can access the network setting
    • Go to Network Admin then Setting and find the Max upload file size setting.
    • Change the default value which is 5000 kb(5MB) to 10000 kb(10MB) or any value that match the PHP setting in the server.
    • At this point, your maximum upload size should work as you set.

 

Finish the server setting

Now we just set the server setting for increasing the maximum upload file size for WordPress Network. But if you don’t want to touch the server setting, what we can do?

 

Unfortunately, the PHP setting must be done on the server. But if you want to set all three PHP settings (upload_max_filesize,post_max_size,memory_limit) to be less than the server setting, there is an option you can follow.

Note that you can check what are the PHP settings for your site by adding the phpinfo() code in your PHP file that I mention above.

Option: Use the ini_set() which is a PHP function

    • Open the functions.php in your WordPress single site if you don’t have this file, you can create one under your active theme folder. Example, wp-content/themes/YourActiveTheme/functions.php
    • add the code below in this file and save it. Then refresh your WordPress single site and checking by go to Medial menu and click on the “Add New” button and test it.
@ini_set( 'upload_max_filesize' , '10M' );
@ini_set( 'post_max_size', '12M');
@ini_set( 'memory_limit', '32M' );

 

That’s it. You don’t need to set the .htaccess file or edit the php.ini or user.ini.

 

Now you can check and test it by using the Media upload. Simply, login to WordPress single site and go to Media menu. Then click on Add New. You will the text that tells you the maximum upload file size there.

 

If you want to increase the maximum upload file size for WordPress single site(Not Network site), you can check this post.