Changing WordPress File Upload Limits

I can’t tell you how much time I’ve wasted over the years trying to get WordPress to accept larger upload file sizes. If, like me, you run WordPress on your own server, it’s complicated by the fact you need to change two settings in the php.ini file to make the change:

upload_max_filesize = 16M
post_max_size = 16M

What’s worse, you have to find the correct php.ini file to change. There are likely dozens of them installed on your system…and only one of them is important to WordPress.

What’s not at all intuitively obvious is that the obvious php.ini file — /etc/php/<version>/apache2/php.ini — is the wrong one.

Instead, you want to change /etc/php/<version>/fpm/php.ini. That’s because most modern WordPress installations use a special service that runs php stuff faster.

You’ll also need to remember to restart the right service for this to take effect. Again, for most modern WordPress installations, this isn’t the obvious apache2. No, it’s that obscure service which runs php faster:

 sudo systemctl restart php7.4-fpm

This is under Debian, so your approach may be different. Note, too, that you have to restart the correct version of php-X.Y-fpm, because you can have more than one running on your system.

Personally, I think this complexity is nuts. Spending time rooting around among apparently identical files, each of which might legitimately be considered to be The One True PHP.ini File, is ridiculous.

Addendum

I raised the issue of the WordPress dashboard providing the path information to the correct php.ini file on the support forum. Some very helpful users directed me to the Health Check & Troubleshooting plugin that’s maintained by the WordPress organization. It adds a number of nifty new capabilities to the Site Health – Info page…and also displays the path to the current php.ini file when you click the View extended PHP information button it adds to the bottom of that page (click to enlarge):

Clicking it displays the following (click to enlarge):

There’s a ton of additional information available as well. Recommended!

2 thoughts on “Changing WordPress File Upload Limits”

  1. I just tried this, and the location of the button moved. If you it at the bottom of the “Info” tab, look in the “Tools” tab under “PHP Info”.

Leave a Comment

Your email address will not be published. Required fields are marked *

Categories
Archives