Upload_max_filesize at 2M despite different setting

Put, as a test, upload_max_filesize at 400M. In every file possible it is 400M except for my frontend CMS where it states I can’t upload files larger than 2M. Uploaded an info.php file and there is also at the value of 2M. Previously did’t had that issue. Changed the value to something smaller like 100M, thinking I may encounter an unknown protection feature, or something, and still nothing. Google was my friend, and Gemini, and Copilot and GPT but none could figure out what’s happening. Thank you for any help. I am exhausted.

1 Like

You must edit the php.ini file for the PHP version your site is using. If your site uses PHP version 8.3, you must edit the file /etc/php/8.3/fpm/php.ini and not only change this directive:

upload_max_filesize = 400M

You must also modify the post_max_size directive (add 10-20M more than the size used in upload_max_filesize) :

post_max_size = 420M

Once done, restart the php-fpm service (in this example it is php8.3-fpm):

systemctl restart php8.3-fpm

Still 2M. As before php.ini has the correct values. And I didn’t had that problem in the past, don’t know really how far back but didn’t. Checked fpm/pool.d/*.conf and it has nothing related post size that could ovveride those values. Maybe php.ini files arren’t picked up and 2M is a default server value.

If you checked the PHP version used by your site, modified the php.ini file for that version, restarted the service and still doesn’t work, check whether you have some .user.ini file in your docroot directory.

1 Like

try running something like this in various directories
NOTE: if unfamiliar, while the “dot”, “.” is typically used with find, as it means “[find in] the current path”, try instead indicating the following paths (from whatever is your current location)
find /home/most-probable-username/ [etc]
find /etc/php*/ [etc]
find /etc/nginx/

Good luck!

sudo find . -type f -iname “*.conf” | xargs rg server_name
rg: ./conf/web/jellyfin.ai-anon.com/nginx.conf: Permission denied (os error 13)
rg: ./conf/web/whatsonyourbrain.local/nginx.conf: Permission denied (os error 13)
rg: ./conf/web/ai-anon.local/nginx.conf: Permission denied (os error 13)
rg: ./conf/web/statecollegeguitarlessons.local/nginx.conf: Permission denied (os error 13)
./web/ai-anon.local/public_html/webserver-configs/nginx.conf
7: server_name localhost;
rg: ./conf/web/centrewebdesign.local/nginx.conf: Permission denied (os error 13)
rg: ./conf/web/vps111.local/nginx.conf: Permission denied (os error 13)
rg: ./conf/web/neutility.local/nginx.conf: Permission denied (os error 13)
rg: ./conf/web/october.local/nginx.conf: Permission denied (os error 13)
xiola@ai-anon:/home/ajaxstardust$

changing of course, -iname and… whatever the other thing to suit your needs.

Edit:
note, lacking the … advantage of CSS, it found my desired pattern , on line 7 of something

so, you’d change your thing to find it … but don’t limit it in -iname “*.ini” always. maybe try other or just omit the name altogether, finding only by -type f. can’t be that many. if yu’re just learning. :wink:

In other words, for a 5-year-old i suppose

find . -type f | xargs grep -iE “upload_max” (i foreget the exact directive)

dunno what your skill level, but i personally like to learn stuff about commands that some random dude is trying to get me to try…

e.g. explainshell.com - find . -type f -iname "*.conf" | xargs grep -i -E server_name

1 Like

have you tried running php --ini
It will tell you all the config files that are loaded and see which config is impacting this value.