How to Modify the PHP Max Upload Size
![How to Modify the PHP Max Upload Size](https://www.hostinger.com/tutorials/wp-content/uploads/sites/2/2021/11/php-8-2.jpg)
When you try running a script, plugin, or uploading large files to your website, you might encounter an error. One of the possible causes of this issue – the upload exceeds the default maximum file size configuration on your web server.
In this article, we will show you three easy ways to increase the size limit by modifying the PHP maximum upload size.
![](https://www.hostinger.com/tutorials/wp-content/uploads/sites/2/2022/11/eBook-Speed-Up-your-website-1024x283.png)
Why Change the PHP Max Upload Size
The default maximum upload file size may vary depending on your hosting provider, usually staying around 128 MB. While this is typically enough for audio or picture files, you may encounter an error when uploading large files such as long videos.
If your site consists mainly of such content, you might want to increase the upload file size limit for more flexibility. On the other hand, you may wish to decrease the PHP max post size if you have limited storage.
How to Change the Maximum Upload Size for PHP Scripts
There are several methods to modify your site’s maximum upload file size, and they may vary depending on your circumstances and preferences. Users can change PHP parameters by using the PHP configuration menu on their hosting control panel or manually modifying specific scripts that handle file uploads.
In most cases, you can change the PHP maximum file size limit by editing the php.ini file. If you are using a shared or cloud hosting plan, you’ll want to modify the .htaccess file instead.
Clearing the cookies will log you out of previously-visited websites. Thus, we recommend saving your login information before following this method.
Let’s take a look at three easy ways to edit your PHP settings and adjust your upload file size limit.
Option 1. Changing Maximum Upload File Size via hPanel
- To modify file upload limitations in Hostinger’s hPanel, click Manage on the Hosting panel and look up PHP Configuration in the Advanced section.
- Open the PHP Options tab. Users can change various limits and parameters on this page, including max execution time and memory limit.
- To change the maximum size for uploaded files, search for the uploadMaxFilesize field. Choose your desired data size from the drop-down menu. In the example below, the default size is set to 512 MB.
- Another option you might want to change here is postMaxSize. It controls the maximum size of files uploaded using the POST method.
- Don’t forget to click Save at the bottom right corner of the page after you finish editing the settings.
Important! Note that the postMaxSize should always be larger than uploadMaxFilesize to avoid errors when uploading data.
Option 2. Altering PHP Parameters Using cPanel
- Access your cPanel dashboard and find Select PHP Version in the Software section. In this menu, users can change their PHP version, choose which extensions to activate, and change other PHP-related settings.
- Click the Options tab and search for post_max_size and upload_max_filesize. Choose your desired file upload limits from the dropdown menu.
Option 3. Changing PHP Post Max Size via the .htaccess File
- To change your post size limits using PHP scripts, navigate to File Manager in your hPanel.
![](https://www.hostinger.com/tutorials/wp-content/uploads/sites/2/2022/11/eBook-Speed-Up-your-website-1024x283.png)
- Open the public_html folder and find .htaccess.
- Open the file and insert the following PHP scripts:
php_value upload_max_filesize XXM php_value post_max_size XXM
- Change the “XX” into your desired size.
- Once you’re done with the configuration, click Save & Close.
Pro Tip
You can also edit .htaccess via an FTP client like FileZilla. If you can’t find the .htaccess file, configure your control panel or FTP client to display hidden files.
How to Check the Maximum File Size Value
After changing the settings of your uploaded file size limits, we need to confirm them with the phpinfo() function to ensure they’re already implemented on the system. Simply create a new PHP file in the public_html directory of your site and insert the following PHP code:
<?php phpinfo(); phpinfo();
You can name the file anything you want. In this example, we named it phpinfo.php. To access the file we just created, just add /phpinfo.php at the end of your site’s domain. It may look like this: http://yoursite.com/phpinfo.php.
You’ll see two columns — local value and master value. Local values are set within .htaccess and override the master values which are set within the php.ini file. Pay no mind to the master values and seek the local values for upload_max_filesize and post_max_size instead.
If the local values of both parameters are the same as you configured, you have successfully changed your website’s PHP file size limits.
![Hostinger web hosting banner](https://www.hostinger.com/tutorials/wp-content/uploads/sites/2/2023/11/Web-hosting_in-text-banner.png)
Conclusion
By modifying PHP settings on your web server, you may no longer encounter errors during file upload processes. This method lets you submit larger files to the web server by increasing the default limit for uploads. Alternatively, you can decrease it to reserve storage space.
If you have questions or other tips and tricks about this topic, leave them in the comment section below.
Comments
May 14 2017
Sorry but it's still not working.
August 23 2019
Try Again
November 21 2017
It freaking worked. Thanks a ton
April 26 2018
method 3 has worked for me thank you very much
April 28 2018
Hey THOMAS, Glad it helped you!
July 20 2018
Very helpful post. Thank you very much!
August 16 2018
Thank you! The first option worked for me.
September 25 2018
Thank you! The 3rd method worked for me, I appreciate it.
October 05 2018
It worked by using method 3. Thanks!
November 24 2018
perfectly worked for me 2nd method.
February 13 2019
Thanks alot,method 3 worked for me...
May 04 2019
This solution work for me in laravel.
May 12 2019
Really appreciate this tutorial. Thanks for making it.
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/
August 02 2019
Thanks.
September 12 2021
Can someone help to resolve this issue? I am still facing error "413 Request Entity Too Large Zcachex2/17.29"
September 20 2021
Hi there, it looks like this article on 413 error should be helpful to you (if you have a VPS, refer to step 3).
June 09 2022
i am limited to only 512MB, cant increase more. whereas i want to upload 750 MB of files.
July 08 2022
Hey there! The reason you see the option to include the Max Upload Size up to 512 MB is that it's the limit that your hosting plan has. In case you would need to increase the limit more, you would need to consider upgrading your hosting plan ?
August 06 2022
File is too big (max. 256MB)! Upload will be skipped. this error I encounter. how to fix this error
August 12 2022
Hi there. The maximum upload size will depend on your hosting plan, if the maximum file size is set to 256 MB then you would not be able to increase more than that. However if you're trying to upload files through File Manager, you can alternatively use an FTP client to upload larger files than 256 MB. You can check out this resource to learn how to do it ?