The Settings That Matter
- upload_
max_ the largest single file PHP accepts. Default 2M.filesize: - post_
max_ the largest whole request, files and form fields together. Default 8M. PHP's documentation says it must be larger than upload_size: max_ filesize. - memory_
limit: the memory one script may use. Default 128M. PHP's documentation advises keeping it larger than post_max_ size, and image processing after the upload needs room too. - max_
execution_ and max_time input_ how long a script may run and how long PHP may spend reading the request. Raise them if large uploads arrive over slow connections.time: - max_
file_ how many files one request may carry.uploads:
Find the Right php.ini
On Debian and Ubuntu, each way of running PHP has its own php.ini:
| Used by | File |
|---|---|
| PHP-FPM | /etc/ |
| Apache module | /etc/ |
| Command line | /etc/ |
Replace 8.3 with your version (php -v). php --ini shows only the command-line files, so a value it reports says nothing about your website. Nginx always uses PHP-FPM; Apache uses the module unless you set it up with PHP-FPM. On AlmaLinux and Rocky Linux there is one /etc/php.ini plus /etc/php.d/, and Apache uses PHP-FPM by default. See what is PHP-FPM.
Set the New Values
A small file of your own in the conf.d folder keeps your changes apart from the distribution's php.ini. For PHP-FPM on Debian and Ubuntu:
sudo nano /etc/php/8.3/fpm/conf.d/99-uploads.iniupload_max_filesize = 64M
post_max_size = 72M
memory_limit = 256M
max_execution_time = 120For the Apache module, the folder is /etc/php/8.3/apache2/conf.d/; on AlmaLinux and Rocky Linux, /etc/php.d/. For one site only, set the values in its PHP-FPM pool file instead, for example php_.
Apply the Change
sudo php-fpm8.3 -t
sudo systemctl reload php8.3-fpmOn AlmaLinux and Rocky Linux: sudo php-fpm -t, then sudo systemctl reload php-fpm. A reload is enough, because the PHP-FPM master process starts over with the new php.ini values without stopping the service; restart only if the old values remain. With the Apache module, run sudo apachectl configtest, then sudo systemctl reload apache2; a reload lets running requests finish.
Check That PHP Uses the New Values
echo '<?php echo ini_get("upload_max_filesize"), " ", ini_get("post_max_size");' | sudo tee /var/www/example.com/limits.php
curl https://example.com/limits.php
sudo rm /var/www/example.com/limits.phpThe output should read 64M 72M. A phpinfo() page shows the same values and the Loaded Configuration File, but delete any such test file immediately: it shows paths and settings to anyone.
Raise the Web Server's Limit
Nginx refuses request bodies larger than client_, 1 MB by default, with 413 Request Entity Too Large, before PHP sees them. Set it in the server block, slightly above post_
client_max_body_size 80M;Then run sudo nginx -t and sudo systemctl reload nginx.
Apache limits request bodies with LimitRequestBody, a size in bytes. Since Apache 2.4.54 the default is 1073741824 bytes (1 GB); in 2.4.53 and earlier it was 0, which means no limit. If a value lower than your uploads is set, Apache rejects the request with an error, usually 413. Look for it with sudo grep -ri limitrequestbody /etc/apache2/ (or /etc/httpd/), and raise it in the virtual host, for example LimitRequestBody 75497472 for 72 MB. Test and reload. A proxy or CDN in front of the server may have its own limit as well.
Troubleshooting
- The old value still shows: you edited another php.ini than the one in use, or PHP-FPM was not reloaded.
- 413 error: the web server's limit, not PHP's.
- The form arrives empty: the request exceeded post_
max_ size, so PHP left $_POST and $_FILES empty; the PHP log usually has a warning about the size. - The upload stops partway: raise max_
input_ time and max_ execution_ time, and check that the temporary folder has room; see how to check disk space in Linux.
For WordPress on Nginx, the same limits appear in how to install WordPress with Nginx.
Updated:
Linux VPS with Full Root Access
MUVCloud cloud servers run on KVM with Enterprise NVMe SSD storage and full root access, in Turkey, the Netherlands, and the USA.
More Guides
No Limits on Service or Support
You are not on your own as your projects grow. Our support engineers are ready 24/7, on several channels, whenever you need them.

- 100% customer satisfaction goal
- Our own hardware
- 24/7 ticket and email support
- 4 countries with locations