I upgraded my blog server from Ubuntu 22.04 to 24.04 only to realize today that I couldn’t upload pictures — that ancient 2 MB default cap had quietly reasserted itself.
The reason it came back: the upgrade installed a fresh PHP 8.3 with a clean php.ini, so all my old tuned values were left behind on the previous version’s config.
I forgot where I put it last time, but here’s where I fixed it this time around. In /etc/php/8.3/apache2/php.ini:
upload_max_filesize = 256M
post_max_size = 256M
memory_limit = 256M
post_max_size needs to be at least as high as upload_max_filesize, since the upload travels inside the POST body — set the limit high but leave post_max_size low and you’re silently capped at the lower number. And I bumped memory_limit to match, for good measure.
Then restart Apache so it picks up the change:
sudo systemctl restart apache2