I am using my own localhost (ubuntu and apache2) for running wordpress 4.8 . I want to increase maximum upload file size. I tried these ways but didn't solve :
1.creating php.ini
in /var/www/html
or changing it in /etc/php/7.0/apache2/php.ini
:
upload_max_filesize = 512M
memory_limit = 512M
post_max_size = 512M
max_execution_time = 300
2.changing .htaccess
in /var/www/html
:
php_value upload_max_filesize 512M
php_value post_max_size 512M
php_value max_execution_time 300
php_value max_input_time 300
3.adding these line of codes in functions.php
file in the theme folder:
@ini_set('upload_max_size' , '512M');
@ini_set('post_max_size', '512M');
@ini_set('max_execution_time', '300');
4.using Upload Max File Size plugin. this plugin changed Maximum upload file size: 2 MB.
message but after uploading file more than 2mb the HTTP error.
accrued. (for fixing this i also tried every solution i found on web (ex: +,+,+) but nothing changed. also turning on wordpress log cant help me. there wasn't anything!! So i gave up. i think the root of this error is bad fix for this problem)
5.changing permissions of all files and folder to 777.
6.after every fix i tried, i also restart apache but nothing changed:
$ sudo service apache2 restart
The usual, automatic way; Open WordPress admin, go to Plugins, click Add New. Enter “increase maximum upload” in search and hit Enter. Plugin will show up as the first on the list, click “Install Now”
Your WordPress hosting provider will set a default maximum file upload size when you sign up and install WordPress. Your hosting provider defines this limit, and it usually ranges from 2MB to 500MB. For most WordPress website owners, this limit will be more than enough.
Go to C:/Xampp/php/php.ini and find:
memory_limit=.....M
Change it to:
memory_limit=10000M
Then scroll down to:
post_max_size=.....M
And change it to:
post_max_size=9999M
Find:
file_uploads=...
If it's of write:
file_uploads=On
Scroll down and find
upload_max_filesize=....M
Write there:
upload_max_filesize=9000M
Also find:
max_file_uploads=.....
And write there:
max_file_uploads=10000M
Attention! Be careful! "Memory_limit" should have the largest number of megabytes. The next is "max_file_uploads", after which is "post_max_size", and last the "upload_max_filesize".
If there is still the same error, make your .htaccess like this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /your_site_name/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /your_site_name/index.php [L]
</IfModule>
# END WordPress
# WP Maximum Execution Time Exceeded
<IfModule mod_php7.c>
php_value max_execution_time 300
php_value upload_max_filesize 9000M
php_value post_max_size 9999M
php_value max_input_time 300
</IfModule>
You can change these lines on your php.ini
file of currently running php version.
Maximum allowed size for uploaded files.
upload_max_filesize = 256M
I shouldn't create any php.ini
file in /var/www/html/
. I found /etc/php/7.0/apache2/php.ini
path in phpinfo()
details. So i found and changed these configs in this file : upload_max_filesize
, memory_limit
, post_max_size
and max_execution_time
.
NOTE: I was right!
HTTP error.
while uploading media was because of bad fix for this problem. now i can upload any media correctly :)
you need also to add this filter to the functions.php file to see the allowed upload in your Wordpress , its good to not use plugin :)
//filter
add_filter('upload_size_limit', 'increase_upload');
function increase_upload($bytes) {
return 262144000;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With