Home >Backend Development >PHP Tutorial >Modify PHP file upload size in windows/linux_PHP tutorial
In PHP, only 2MB files can be uploaded by default. If we want to upload more and larger files, we need to modify some parameters. Please refer to them below.
linux system
1./usr/local/nginx/conf/nginx.conf
Modify
client_max_body_size
2./usr/local/php/etc/php.ini
Modify
post_max_size
upload_max_filesize
3. Restart LNMP /root/lnmp restart
windows system
The default post_max_size of PHP is 2M. If the POST data size is greater than post_max_size $_POST and $_FILES superglobals will be empty.
Find
post_max_size .
changed to
post_max_size = 150M
Look for upload_max_filesize, the default is 8M and change it to
upload_max_filesize = 100M
Another thing to note is that post_max_size is better than upload_max_filesize.
Summary
In fact, it is to modify three parameters in php.ini
upload_max_filesize = 8M
post_max_size = 10M
memory_limit = 20M