Increasing image upload limit in Wordpress: No method is working
Hello!
I'm trying to increase the image upload size limit for Wordpress sites on my server.
I've tried these steps from another Linode tutorial, with no luck.
I've also tried doing it via functions.php within Wordpress, via .htaccess, via .users.ini, and via a php.ini file in the Wordpress root directory.
None of these methods have worked, and I'm at a complete loss… Any ideas?
6 Replies
I don’t believe you can increase the limit from anywhere other than the main php.ini in use by the webserver (or the PHP process manager, FPM.)
The location of this varies from OS to OS so it’s difficult to know where to guide you.
Is this the one click Wordpress install (from the marketplace) running Debian 10?
Sorry I should have given more info.
I've got a Linode running a LAMP stack with Ubuntu 18.04 LTS.
I followed this tutorial which outlines how to change the main php.ini file. These changes are now live with a 16M limit, however all Wordpress sites on my server still show a 2mb limit in the Wordpress backend.
Thank you.
Edit: Some more info:
PHP version 7.2 is running and detected by Wordpress ("7.2.29-1+ubuntu18.04.1+deb.sury.org+1")
I've updated the php.ini file in /etc/php/7.2/apache2 with the following values:
memory_limit = 128M
upload_max_filesize = 16M
post_max_size = 8M
@chr0s --
It looks like you're using the PHP module for apache(2)… Did you restart the web server after doing this?
-- sw
After changing the php.ini file:
I ran sudo service php7.2-fpm restart
Then sudo systemctl reload apache2
Then rebooted my Linode through the dashboard
Still no luck.
OK, since you've definitively stated that you use php-fpm, /etc/php/7.2/apache2/php.ini was the wrong conf file to modify. You need to change the file /etc/php/7.2/fpm/php.ini.
/etc/php/7.2 is structured as follows:
cli <-- conf files for the the CLI: php(1)
fpm <-- conf files for the the FPM: php_fpm(8)
apache2 <-- conf files for the apache2(8) module
mods-available <-- conf files for the installed php modules
There may be some symlinks of files in mods-available in each of {cli, fpm, apache2}/conf.d/.
Also, in addition to php.ini, underneath /etc/php/7.2fpm are:
php-fpm.conf <-- the conf file for the FPM process
pool.d/ <-- the conf files for each of the FPM process thread pools
You restart php7.2-fpm with systemctl(1)…not service(8):
sudo systemctl restart php7.2-fpm
The command
sudo service php7.2-fpm restart
probably didn't do anything…
You should probably remove the package libapache2-mod-php if you don't use it:
sudo apt-get remove libapache2-mod-php
This will prevent you from modifying the wrong php.ini file in the future.
I can't speak to the "2mb limit in the Wordpress backend"…I don't know if that's a Wordpress limit or if WP is just parroting the PHP limit. If it's a WP limit, none of this is going to help you and you need to consult the WP docs.
-- sw