PHP and MySQL
Why changing upload_max_filesize may not fix PHP uploads
Trace PHP upload limits across post_max_size, web-server limits, temporary storage and the active php.ini.
By AppLaunch Editorial · Reviewed 2026-08-25
Direct answer
The upload ceiling depends on more than upload_max_filesize. post_max_size must cover the whole request, the web server or proxy may set its own size limit, and PHP needs a writable temporary folder. Confirm the settings used by the website, not only those used by PHP commands in a terminal.
What this means in plain English
A PHP upload passes through several size checks. upload_max_filesize limits the file itself, post_max_size limits the whole form request, and the web server or proxy may have another limit. PHP also needs a writable temporary folder with enough free space.
Make sure you edit the settings used by the website. Command-line PHP can load a different php.ini file, so a change shown by php --ini may not affect PHP-FPM or the web server.
Which limit rejects the request first?
| PHP file | upload_max_filesize |
|---|---|
| Whole request | post_max_size plus the rest of the form |
| Before PHP | Proxy and web-server size and time limits |
A simple example
upload_max_filesize is raised to 50 MB, but post_max_size remains 8 MB. A 20 MB image still fails because the whole request is rejected before the file limit matters. Raising the matching request limit and restarting the correct PHP service fixes it.
What to do, step by step
1. Check the PHP settings shown by the website safely.
Start here before buying anything or changing several settings at once. It gives you a clear starting point based on php file: upload_max_filesize. Write the result down so you can compare it later.
2. Compare every request-size limit.
Use the same files, versions and settings that the real project will use. A quick test with an empty or different setup can look successful while completely missing the problem you are trying to solve.
3. Check temporary folder space and permissions.
Try the busiest realistic situation, not the easiest one. Include the people, data, traffic or background work you genuinely expect, then watch for slowdowns and errors rather than relying on a single headline number.
4. Restart the correct service and test a file with a known size.
Finish by checking the result against before php: proxy and web-server size and time limits. Keep the old setting or release available until you know the change works and can be reversed safely.
One more useful tip
The application should still check file type and a sensible business limit. Increasing server limits does not make every uploaded file safe or useful.
Common mistakes and how to avoid them
Editing only the php.ini used by command-line PHP.
This gives a misleading or unsafe result because it leaves out php file. A better approach is to check the php settings shown by the website safely, then check the result before making the change permanent.
Setting post_max_size below upload_max_filesize.
This gives a misleading or unsafe result because it leaves out whole request. A better approach is to compare every request-size limit, then check the result before making the change permanent.
Allowing unlimited uploads without application checks.
This gives a misleading or unsafe result because it leaves out before php. A better approach is to check temporary folder space and permissions, then check the result before making the change permanent.
Words explained
- PHP
- The programming language that runs the server-side part of many websites and applications.
Quick checklist
- Check the PHP settings shown by the website safely.
- Compare every request-size limit.
- Check temporary folder space and permissions.
- Restart the correct service and test a file with a known size.
Common questions
What is the simple answer?
The upload ceiling depends on more than upload_max_filesize. post_max_size must cover the whole request, the web server or proxy may set its own size limit, and PHP needs a writable temporary folder. Confirm the settings used by the website, not only those used by PHP commands in a terminal.
What should I check first?
Start with php file: upload_max_filesize. That is usually more useful than choosing from a marketing label or copying somebody else’s setting.
How can I make the change safely?
Check the PHP settings shown by the website safely. Then change one thing at a time, keep a backup or old version, and use the same real-world test after each change.
What is the easiest mistake to avoid?
Editing only the php.ini used by command-line PHP. Avoiding that one mistake makes the rest of the comparison much more trustworthy.