How can i Increase Max_file_upload_size in CPanel using wordpress

18,077

Solution 1

You should just try adding this to the 2nd line of your wp-config.php file.

This line handles your upload max filesize size *and* your php memory.

// this will change your max file size upload AND your php memory
define( 'WP_MEMORY_LIMIT', '64M' );

More info can be seen here regarding this code from the WP Codex (2/3 down the page):

WP Memory Limit - WP Codex

Solution 2

Add below line on the top of wordpress main index.php :

ini_set('max_file_uploads', 100);

Solution 3

The default upload file size for WordPress is 2 MB, which is a problem if you want to upload a large media files. If you get this error, “The uploaded file exceeds the upload_max_filesize directive in php.ini”, follow these steps:

  1. Locate the php.ini file inside the wp-admin directory (if you can’t find this file see notes below)
  2. Find this line in the php.ini file “upload_max_filesize = 2M” and replace it with a higher value (e.g. “upload_max_filesize = 64M”)
  3. You may also want to increase your max post size. Look for this line in your php.ini file “post_max_size” and increase it as well.
  4. Save the changes to the file inside your wp-admin directory.
  5. Try the upload again
  6. If you still have issues, look for this file in your root directory and make the same changes.

If you don’t have a php.ini file in your directory, you can usually generate one from the control panels of your host.

You can download php.ini file from here.

Alternate way using

htaccess

Add this code in htaccess:

php_value upload_max_filesize 20M
php_value post_max_size 20M
php_value max_execution_time 200
php_value max_input_time 200

You can increase the file upload limit according to your requirement.

Solution 4

As you say, you only have access to cpanel, then go to "file manager" in cpanel and then follow Mahmood Rehman's steps.

You can also configure a FTP account and use ftp app like filezilla for downloading and uploading files direclty to the server, and also to edit php.ini and other files.

Solution 5

Another solution is to point the .htaccess to your custom PHP ini file:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
</IfModule>
<IfModule mod_suphp.c>
suPHP_ConfigPath /public_html/php.ini
</IfModule>

and the write your php.ini files

upload_max_filesize = 64M
post_max_size = 64M
Share:
18,077
Admin
Author by

Admin

Updated on June 15, 2022

Comments

  • Admin
    Admin almost 2 years

    I am using VPS hosting in that i have CPanel login details ,i was installed wordpress and i am trying import some posts that i have exported from last website.But i am getting the error like Max_file_Upload_size is more than 2M.How can i change the max file upload size . I was try to add php.ini file to my root folder but i didn't get any change and aslo add php.ini into wp-admin folder also,but i didn't able to import the files.In my Cpanel i didn't find any php.ini files.i am trying in google also but i didn't get answer for me help me....