Best Way to Modify the PHP Maximum Upload Size
PHP Maximum Upload Size Modify
You can get an error when trying to launch a script, plugin, or upload huge files to your website. One of the possible causes of this problem is that the upload exceeds your web server’s preset maximum file size configuration.
We’ll show you three simple ways to increase the size limit by altering the PHP maximum upload size in this article.
What’s the Point of Changing PHP Maximum Upload Size?
The default limit upload file size varies per hosting provider, however it is usually around 128MB. While this is usually sufficient for music or picture files, huge files, such as extended films, may result in an error.
If your site is mostly made up of this type of information, you may wish to increase the upload file size limit to give yourself more options. If you have a restricted amount of storage, you may want to reduce the PHP maximum post size.
How Do I Change PHP Scripts’ Maximum Upload Size?
There are a few ways to change the maximum upload file size on your site, and they may differ depending on your circumstances and preferences. Users can adjust PHP parameters in their hosting control panel’s PHP configuration menu or by manually editing particular scripts that manage file uploads.
In most circumstances, altering the php.ini file will change the PHP maximum file size limit. If you’re on a shared or cloud hosting plan, you’ll need to make changes to the. htaccess file instead.
Let’s look at three simple techniques to change your PHP settings and increase the size of your upload files.
Option 1: Using cPanel to change the PHP maximum upload size of the file
- Click Manage on the Hosting panel and look for PHP Configuration in the Advanced section to change the file upload limitations in F60host’s cPanel.
- Navigate to the PHP Options tab. On this page, users can alter a variety of limitations and parameters, such as the maximum execution time and memory limit.
- Look for the uploadMaxFilesize field to adjust the maximum file size for uploaded files. From the drop-down menu, select the data size you want. The default size in the sample below is 512 MB.
- postMaxSize is another setting you might wish to tweak here. It regulates the maximum file size that can be uploaded via the POST method.
- After you’ve finished editing the settings, don’t forget to click Save in the bottom right corner of the page.
Option 2: Using cPanel to Change PHP Parameters
- Select PHP Version from the Software section of your cPanel dashboard. Users can alter their PHP version, which extensions to activate, and other PHP-related settings via this menu.
- Search for post max size and upload max filesize on the Options tab. From the dropdown menu, select the file upload limits you want.
Option 3: Using the.htaccess file to change the PHP Post Max Size
- Navigate to File Manager in your cPanel to adjust your post size restrictions with PHP scripts.
- Locate the.htaccess file in the public_html folder.
- Open the file and paste the PHP scripts into it:
php_value upload_max_filesize XXM
php_value post_max_size XXM
- Change the “XX” to the size you want.
- After you’ve finished configuring the system, click Save & Close.
How to Check the Maximum File Size Value?
After making changes to your uploaded file size limits, we’ll need to double-check them with the phpinfo() function to make sure they’re in place. Simply create a new PHP file in your site’s public_html directory and paste the following PHP code into it:
<?php
phpinfo();
phpinfo();
You are free to name the file whatever you want. We called it phpinfo.php in this case. Simply append /phpinfo.php to the end of your site’s domain to view the file we just produced. It could be something like http://yoursite.com/phpinfo.php.
There are two columns in this table: local value and master value. Local values override master values set in the php.ini file and are set in the.htaccess 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 match what you specified, you’ve successfully modified the PHP file size restrictions for your website.