Max WP upload limit won't change after editing php.ini - php

I'm wondering if anyone has any ideas about this - I've been struggling with increasing the max upload size for my wp site for weeks now.
I've tried editing the php.ini parameters 'upload_max_filesize' (umf), 'post_max_filesize' (pmf), 'memory_limit' (ml) to no avail. I need to upload files up to 500M in size and mysteriously managed to get it to upload somewhere around 410M max (even though I had 500M in the .ini file and the wp media panel said 'max file upload size: 500M'). Suddenly today I went to upload and it read 'max file upload size: 0 B' - I checked the .ini and it was set to 2M for 'umf', 0 for 'pmf' (something must have been written over).
I changed umf to 500M, pmf to 500M, ml to 1000M, restarted nginx via command line (the host is digital ocean, os Ubuntu) and the WP media interface still reads 0 B. I checked my info.php file and umf reads 2M there. The loaded config file path is '/etc/php/7.0/fpm/php.ini' and that's the one I'm editing. If anyone had any suggestions before I smash my screen w/ a hammer I would greatly appreciate it :)

Try doing it in your functions.php and see if it makes a change or not.
#ini_set( 'upload_max_size' , '500M' );
#ini_set( 'post_max_size', '500M');
#ini_set( 'max_execution_time', '300' );
If that doesn't work you can also do it in your .htaccess file for WordPress if you're using Apache.
php_value upload_max_filesize 500M
php_value post_max_size 500M
php_value max_execution_time 300
php_value max_input_time 300

Related

The uploaded file exceeds the upload_max_filesize directive in php.ini. Unable to upload a new theme in wordpress

I am unable to upload a new theme in wordpress.The maximum limit showing right now is 10 mb. What changes should I make in CPanel. I have created a new file in Public_html named php.ini.
and pasted these lines.
upload_max_filesize = 256MB
post_max_size = 32M
memory_limit = 32M
max_execution_time = 300
1: Theme Functions File
There are cases where we have seen that just by adding the following code in theme’s functions.php file, you can increase the upload size:
#ini_set( 'upload_max_size' , '64M' );
#ini_set( 'post_max_size', '64M');
#ini_set( 'max_execution_time', '300' );
2. Create or Edit an existing PHP.INI file
For this method you will need to access your WordPress site’s root folder by using FTP or File Manager app in your hosting account’s cPanel dashboard.
In most cases if you are on a shared host, then you will not see a php.ini file in your directory. If you do not see one, then create a file called php.ini and upload it in the root folder. In that file add the following code:
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
This method is reported to work for many users. Remember if 64 doesn’t work, then try 10MB (sometimes that work).
3. htaccess Method
Some people have tried using the .htaccess method where by modifying the .htaccess file in the root directory, you can increase the maximum upload size in WordPress. Edit the .htaccess file in your WordPress site’s root folder and add the following code:
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300
Using .htaccess file in wordpress. You can define below lines,
Open it .htaccess in folder and added the following into a newline at the end of the file.
php_value memory_limit 256
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 1000
Save your changes and overwrite the .htaccess file.
Get More info, you can follow the link,
For upload file size: https://www.bitcatcha.com/blog/increase-maximum-upload-file-size-in-wordpress/
For Increase Memory Limit size :https://premium.wpmudev.org/blog/increase-memory-limit/
you can create php.ini file in wp_admin folder in root wordpress directory
open php.ini and override these values
1- upload max size
2- post max size
3- max execution time
now php.ini file looks like that
upload_max_filesize = 128M
post_max_size = 128M
max_execution_time = 180

WHM Unable to Change Wordpress Max Upload Size

I have several Wordpress installs in a WHM Environment. My WHM PHP(5.6) max upload size is set to 100MB & PHP max POST size 150MB. I also check MultiPHP INI Editor and the max upload size is the same. But for some reason all my Wordpress installs have a max upload size of 8MB. I cannot get it to change.
I've tried the following:
Added php.ini file, but does not help/change
Added php code to the .htaccess, but it causes a Internal Server Error
Added php code to the theme's function.php, but it causes a Internal Sever Error
Spoke with HostGator customer server for a couple hours and they were not able to help.
Any ideas?
Hi Try to add these lines in your theme functions.php
#ini_set( 'upload_max_size' , '64M' );
#ini_set( 'post_max_size', '64M');
Or verify your php.ini files and change these values
upload_max_filesize = 64M
post_max_size = 64M
Or add this in your .htaccess files
php_value upload_max_filesize 64M
php_value post_max_size 64M
You should restart your apache server after changing the php.ini file to take effect on your hosting.
If you are using Wordpress multisites you can have a restriction from Wordpress itself you find it under Settings -> Network settings -> Maximum file size
If you don’t want coding, directly increase max upload size through this free plugin https://ziscom.today/max-upload-size/
After installation go to WordPress menu ‘Max Upload Size’
* Only enter the numeric value in bytes
* 1024 bytes = 1KB
* 1048576 bytes = 1MB
It worked for me. Hope it help for you.

Where to add post_max_size in php.ini?

I am learning wordpress and i need to edit post_max_size in php.ini. I am using Wamp 3.0.6 64 bit in my local machine. php version is 5.6.25 . I need to change value of post_max_size in php.ini. when i opened that file via wamp control panel, i am not able to find post_max_size(it`s not there in php.ini). I searched everywhere, i am not able to find where i should create this value post_max_size=1024M. so what i need is a section name/line no or something where i can create post_max_size=1024M.
If post_max_size doesn't exists, you can add it everywhere in php.ini file (e.g - on the end of the file)
; Maximum allowed size for uploaded files.
upload_max_filesize = 40M
; Must be greater than or equal to upload_max_filesize
post_max_size = 40M
if you dont want to write code in php.ini file then you can use this code in your wordpress theme functions.php file.
#ini_set( 'upload_max_size' , '64M' );
#ini_set( 'post_max_size', '64M');

Maximum upload file size not reflecting to phpinfo()

My problem is that when I check to wp-admin/media-new.php I see Maximum upload file size: 8 MB. Now I change the php.ini located at /usr/lib/php.ini I change the upload_max_filesize to 64M and post_max_size 64M. Then when I checked back to wp-admin/media-new.php it is now 'Maximum upload file size: 15M' it should be 64M
I even try following this http://www.wpbeginner.com/wp-tutorials/how-to-increase-the-maximum-file-upload-size-in-wordpress/ but it doesn't help it. it looks like it is limited to 15M? I try to change the post_max_size to 14M then it reads now on wp-admin/media-new.php to 'Maximum upload file size: 14M' it looks like it only limits to 15M. I restarted the apache but still it won't work and it only shows 15M
I checked the phpinfo() and the file loaded is correct which is /usr/lib/php.ini
Is there any settings in wordpress that is limiting the upload file size except on the network setting? no right? What could be the problem?
I Fixed my issues. Here are what I've learned:
1) Make sure there are no conflict with your php.ini.. I checked my phpinfo() and the file loaded is /usr/local/lib/php.ini however there is php.ini placed in the wp-admin/ folder so I deleted it and this cause overriding the setting.
2) If you are running multisite make sure that 'Max upload file size' option in wp-admin/network/settings.php is correct based on your desire cause this will reflect in the main site.
You can use this cod ein .htaccess file.
<IfModule mod_php5.c>
php_value post_max_size 128M
php_value upload_max_filesize 128M
php_value memory_limit 500M
</IfModule>
Change file size as your requirement.
I hope this will work for you.

Increasing the upload size in WordPress

I wanted to increase the file upload size limit in wordpress without editing php.ini
So I tried adding .htaccess to the wp-content/uploads directory with rules like these:
php_value upload_max_filesize 10M
php_value post_max_size 20M
php_value memory_limit 32M
This doesn't work in wp-content/uploads, the upload max is still 2MB
This does work if I put this in the websites .htaccess file though.
Why won't this work if I just put the htaccess in the uploads directory? Are there any risks in increasing the upload size for the entire site?
.htaccess won't work unless the PHP script handling the upload exists at wp-content/uploads/ (which it does not). Placing it in that folder does not have the result you may expect because it only impacts scripts located in that folder.
You might try placing .htaccess file into /wp-admin/ which will change upload settings for all files handled inside the admin PHP scripts.
Unclear from your post where else users may be uploading files... are you using upload forms in your public-facing website? If so, you may not want to update the settings server-wide. If not, I see no big risks in making the change.
For increase PHP's file upload limit.
In php.ini file, change the parameter to whatever size you need
(example: )
upload_max_filesize = 32M
...
Simply create blank text file. Save As php.ini
Inside the text file copy-paste the following:
upload_max_filesize = 32M
post_max_size = 32M
============================
Unable to access root directory , than
add this to top of wp-config.php
define('WP_MEMORY_LIMIT', '64M');
To Increase the Maximum file size upload in wordpress
find the php.ini location
#find / -iname php.ini
Get into the folder By default it is 2M we can incerase by setting value to the parameter
#vim php.ini
upload_max_filesize = <Userdefined size> (For eg 20M)
post_max_size = <Userdefined size >
Then if you are using php7.0 restart php7.0-fpm service
#systemctl reload php7.0-fpm.service
If .htaccess not change value and also php.ini not change values, search for .user.ini file in root folder server and search for upload_max_filesize and post_max_size values and replace them.
For increasing PHP's file upload limit.
Go to wordpress root directory and open .htaccess file. In my case it was found in /var/www/html
php_value upload_max_filesize 128M
php_value post_max_size 128M
php_value memory_limit 256M
php_value max_execution_time 300
php_value max_input_time 300
The above code increased my file upload limit to 128 MB in wordpress
2021:
Access /etc/php/8.0/apache2/php.ini
Increase the value of post_max_size. The default value is 8M.
Restart the server with sudo service apache2 restart
Try to add this to functions.php of your theme
#ini_set( 'upload_max_size' , '10M' );
#ini_set( 'post_max_size', '20M');
#ini_set( 'memory_limit', '32M' );

Categories