How can i Increase Max_file_upload_size in CPanel using wordpress

一个人想着一个人 提交于 2019-12-06 10:50:45

问题


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....


回答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




回答2:


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.




回答3:


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

ini_set('max_file_uploads', 100);



回答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.




回答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



回答6:


"Error : The uploaded file exceeds the upload_max_filesize directive in php.ini." Solved by uploading my theme manually. I was also facing the same problem while uploading wordpress theme, My theme is of 3.2MB in size. I searched for following line in wp-config.php file,

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

But it was not found. so I tried another approach, I Log into cpanel went into the directory where wordpress is install then /wp-content/themes, choose upload option and upload my theme and it get installed. :D




回答7:


Select PHP Version. Switch to PHP Options upload_max_filesize 128MB




回答8:


Create php.ini file and paste below code and upload in public_html its working fine for me.

[PHP]
file_uploads = On
post_max_size = 750M
upload_max_filesize=750M
max_execution_time=5000


来源:https://stackoverflow.com/questions/21012144/how-can-i-increase-max-file-upload-size-in-cpanel-using-wordpress

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!