How to increase the maximum file upload size in wordpress

How to increase the maximum file upload size in wordpress.

Hopefully, This applies to several scripts as well. There are many ways to get this done. The difference is the way , the hosting providers or the server supports.

Way 1 : Custom php.ini

Adding php variables in a custom php.ini. It is supported by most of the providers now a days.

If you cant find a file php.ini under your directory, create it with 644 permission.

Edit  php.ini file and Add the following lines to it.

 

upload_max_filesize = 1024M
post_max_size = 1024M
max_execution_time = 1000

Save the file and try reloading the uploader and upload the files.

Sometimes, The scripts wont detect the custom php.ini. I have came across this often. Fix is to just add a line in .htaccess

SetEnv PHPRC /home/<username>/public_html/<folder if any>php.ini

E.g :  SetEnv PHPRC /home/teksupportin/public_html/php.ini

Path is where you have created that. It will force to take custom php.ini

 

Way 2 : adding php_flag in .htaccess

Setting up the php variables on .htaccess with php_flag

Open .htaccess in the public_html or the document root.

Add the following lines

php_value upload_max_filesize 1024M
php_value post_max_size 1024M
php_value max_execution_time 1000
php_value max_input_time 1000

This is a common way but tends to be erroneous if careless

Way 3 : adding as code in functions.php

 

Defining the limits in the code

Open the theme folder >> select theme >> edit functions.php

Add the lines to it

 

@ini_set( ‘upload_max_size’ , ’1024M’ );
@ini_set( ‘post_max_size’, ’1024M’);
@ini_set( ‘max_execution_time’, ’1000? );

 

Try this tips and let me know if you have any comments.

 

Get more stuff like this
in your inbox

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get more stuff like this
in your inbox

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.