Increasing WordPress Media Manager Upload File Size

Posted on

Server   Operating System            : CentOS 7

WordPress Version                         : 4.5

Webserver Engine                           : Apache Webserver

Increasing Upload File Size in WordPress Media Manager

There are several preparations which is needed to be done. The preparations itself can be divided into two kinds of type as follows :

  1. Preparation in the Server
    1. Edit file php init configuration script

      We have to get an access to the php init script so we can define several parameters in order to upload file with a certain size number. Depends on the system operating itself, the location of the php init script are different. In this case, in CentOS 7 we can get it at /etc/php.ini

      There are several parameter or attribute which need to be changed so that any file which has a certain amount of size can be uploaded. For an example if we want to upload a file which has a size of 120 MB. Below is how to edit the content of configuration in the php init script :

      When we want to upload a file with the size of 120 MB we have to increase the limit a little bit, let say 130 MB. So we have to change the value of the following attribute as follows :

      upload_max_filesize = 130M
      post_max_size = 130M

      Another thing that we have to pay attention is the max_execution_time, I have searched for several articles containing this matter. Some article said that this parameter doesn’t affect the user upload process and some article said the parameter itself is being calculated as part of the attribute which affects upload process.  It also said that max_input_time does really matter to the upload process. In this article, I just want to stick with changing only the max_execution_time’s value, as follows :

      max_execution_time = 300

      We define it to 300 seconds as the above line defined.

    2. Restart Apache Web Service

This is an important part for the process. To be able to implement or to make the changes on the script affect the Webserver, we have to restart it by executing the following command :

[root@localhost ~]# systemctl restart httpd.service
[root@localhost ~]#
  1. Preparation in the Web or in the WordPress itself

In my experience, editing the server configuration file of php.ini does not enough to make the Media Manager can accept the file that has the size we want to be uploaded. We have to edit another file and this time it can be found at /wp-themes/theme_name/functions.php.  Where the theme_name is your current active theme.

At the top of the script of functions.php add the following three lines :


All of the necessary preparation has been done. The next step is uploading the file itself by trying to upload file which has size under 130 MB.

If the above step doesn’t work out. We can try the following solution :

  1. Look for php.ini file configuration.
  2. Edit the file and change the following entry :
; Maximum allowed size for uploaded files.
upload_max_filesize = 130M

Normally which is being displayed in the upload limit filesize in Media Manager refer to this line of configuration. So, the override it, the above line configuration’s value need to be changed. The second line is also needed to be edited. Choose the same value with the ‘upload_max_filesize’ line configuration. Off course the line configuration below, ‘post_max_size’ relates with the previous one because uploading file activity require POST activity.

; Maximum size of POST data that PHP will accept.
post_max_size = 130M

Last but not least we also need to adjust the following line configuration :

max_execution_time = 300

Depends on your network condition, the value of the line configuration above need to be adjusted whether it will take a short time amount or even a long one for your script to be able to process the POST request in order to upload a certain amount size of file.

Leave a Reply