How to change max upload file size in php | PHP Examples
×


How to change max upload file size in php

2950

In mostly  cases default size of uploading files is less than or equal to 2MB on server. So when file whose size greater than 2MB is uploaded on server, it does not allow to upload the file. So to give permission for uploading file size greater than 2MB on server, you should change the permissions on server or in your php.ini file.

First you can change in your php.ini file which you've created in your file folder.

max_execution_time = 5000
max_input_time = 5000
memory_limit = 1000M
post_max_size = 7500M
upload_max_filesize = 7600M


Sometimes php.ini does not work for max upload file size then here's another solution for it.

You can change the permissions for uploading max file size direct in cPanel. For this just search PHP in your cPanel and click on MultiPHP INI Editor. There will show two tabs.
1. Basic Mode
2. Editor Mode

# Click on Basic Mode and select home directory. After selecting change the permissions. After doing changes here save it.

Now select second option which will be like domain_name.com and change here the permissions. Save these changes.  
You can also make changes in Editor mode.

This will work definitely.

You can also do changes for max upload file size in your .htaccess file. Also when you make changes in your cpanel it directly changes the htaccess file code.

For .htaccess file:

# Set the "ea-php56" package as the default "PHP" programming language.
<IfModule mime_module>
AddHandler application/x-httpd-ea-php56 .php .php5 .phtml
</IfModule>

# php -- END cPanel-generated handler, do not edit

# BEGIN cPanel-generated php ini directives, do not edit
# Manual editing of this file may result in unexpected behavior.
# To make changes to this file, use the cPanel MultiPHP INI Editor
(Home >> Software >> MultiPHP INI Editor)
# For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)

<IfModule php5_module>
php_value max_input_vars 80000000
php_value max_execution_time 5000
php_value max_input_time 5000
php_value memory_limit 30000M
php_value post_max_size 7500M
php_value upload_max_filesize 7600M
php_flag asp_tags Off
php_flag display_errors Off
php_value session.gc_maxlifetime 1440
php_value session.save_path "/var/cpanel/php/sessions/ea-php56"
php_flag zlib.output_compression Off
</IfModule>

<IfModule lsapi_module>
php_value max_input_vars 80000000
php_value max_execution_time 5000
php_value max_input_time 5000
php_value memory_limit 30000M
php_value post_max_size 7500M
php_value upload_max_filesize 7600M
php_flag asp_tags Off
php_flag display_errors Off
php_value session.gc_maxlifetime 1440
php_value session.save_path "/var/cpanel/php/sessions/ea-php56"
php_flag zlib.output_compression Off
</IfModule>
# END cPanel-generated php ini directives, do not edit




Best WordPress Hosting


Share:


Discount Coupons

Get a .COM for just $6.98

Secure Domain for a Mini Price



Leave a Reply


Comments
    Waiting for your comments