How to Modify the PHP Maximum Upload Size
access_time
hourglass_empty
person_outline

How to Modify the PHP Maximum Upload Size

Having trouble uploading files to your WordPress site due to the size limit? If that’s the case, you’ve come to the right place. In this article, we’ll show you how to increase the size limit by modifying the PHP maximum upload size.

Why Do You Need to Change PHP Maximum Upload Size?

The standard maximum upload size in WordPress may vary depending on your hosting provider. Usually, it’s ranging from 5 to 128 MB.

Most of the time, 128 MB is enough if you only need to upload a short video or a picture. However, if you want to upload a longer video, you may need to increase the maximum upload size.

That goes double if your maximum upload size is only 5 MB. You won’t be able to install a theme or plugin, considering most plugins go beyond 5 MB these days.

On the other hand, if the size limitation is set too large, someone else may upload a large file that takes a lot of your storage. In this case, you may want to decrease the PHP maximum upload size to prevent that from happening.

How to Change the Maximum Upload Size for PHP Scripts?

In most cases, you can change the PHP maximum upload size by editing a file named php.ini. However, if you’re using Hostinger’s shared hosting plan, you don’t have access to the said file. Instead, you’re allowed to configure most of the PHP values from the .htaccess file.

  1. Navigate to the File Manager in your hPanel, open the public_html folder, and find the .htaccess file.
    Finding the .htaccess file on File Manager.
  2. Open the file and insert the following codes above the #END WordPress line:
    php_value upload_max_filesize  XXM
    php_value post_max_size XXM
  3. Change the “XX” into any size you want. However, note that the post_max_size should always be larger than upload_max_filesize to avoid an error when uploading. For example, if you set the upload_max_size to 356 MB, then the post_max_size should be 357 MB or more.
  4. Once you’re done, click Save & Close.

You can also edit the .htaccess file via an FTP client like FileZilla

Checking the PHP Maximum Upload Size

After changing your PHP maximum upload size, we need to check the current size limit with the phpinfo() function to make sure that it’s already changed.

Simply create a new PHP file on the public_html directory of your WordPress site and insert the following code:

<?php

    phpinfo();

?>

You can name the file with anything you want. In this case, we name it phpinfo.php.

To access the file we just created, just ad/phpinfo.php to the end of your site’s domain (http://yoursite.com/phpinfo.php).

Checking the modified PHP maximum upload size. You’ll see two columns — local value and master value. Local value is set within the .htcaccess and overrides the master value, which is set within the php.ini. Therefore, pay no mind to the master value and seek the local value for upload_max_filesize and post_max_size instead.

If the local values of both parameters are the same as the one you set earlier, then you have successfully changed the PHP maximum upload size for your WordPress site.

Conclusion

You’ve learned how simple it is to change the PHP maximum upload size on WordPress. You can increase the limit when you’re uploading a large file or decrease it a little bit to prevent other users from taking too much space of your storage.

Why don’t you give it a try?

The Author

Author

Edvinas B. / @edvinas

Edvinas mentors and trains every new customer support agent at Hostinger. When he's not teaching new guys the secrets of providing an exceptional service, he likes to travel the world and play basketball.

Related tutorials

Author

Aby Christy Reply

May 14 2017

Sorry but it's still not working.

    Author

    Osama Laden

    Replied on August 23 2019

    Try Again

Author

Abhigyan Reply

November 21 2017

It freaking worked. Thanks a ton

Author

THOMAS NYIRENDA Reply

April 26 2018

method 3 has worked for me thank you very much

    Author

    Domantas G.

    Replied on April 28 2018

    Hey THOMAS, Glad it helped you!

Author

Ramzan khan Reply

July 20 2018

Very helpful post. Thank you very much!

Author

Thais Reply

August 16 2018

Thank you! The first option worked for me.

Author

Akinjide John Reply

September 25 2018

Thank you! The 3rd method worked for me, I appreciate it.

Author

Ervis Reply

October 05 2018

It worked by using method 3. Thanks!

Author

Sadik Reply

November 24 2018

perfectly worked for me 2nd method.

Author

Ahmadu Reply

February 13 2019

Thanks alot,method 3 worked for me...

Author

parik Reply

May 04 2019

This solution work for me in laravel.

Author

joshua houston Reply

May 12 2019

Really appreciate this tutorial. Thanks for making it.

Author

Krister Andersson Reply

May 13 2019

I have created a plugin which makes it much easier to change php settings directly from within the Wordpress administration: https://wordpress.org/plugins/custom-php-settings/

Author

Tolulope Fasinu Reply

August 02 2019

Thanks.

Leave a reply

Comment*

Name*

Email*

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Become a part of Hostinger now!

More in WordPress
Remove Powered By WordPress
How to Remove Powered by WordPress from Footer

Close