How to set PHP maximum upload size?

php configuration

To configure upload size, You need to modify php.ini file, which should be present in /etc/php or similar directory. Mine was in /etc/php/7.1/fpm, as PHP-FPM is used with NGINX.

It is important that there are two options which control maximum upload size:
  • post_max_size - total size of data that could be sent by POST request
  • upload_max_filesize - maximum size of uploaded file

The post_max_size should be larger than upload_max_filesize as there is virtually always some extra data transferred along with uploaded file.

Values accept suffixes like M for megabytes or G for gigabytes.

Also there is a configuration option for maximum amount of simultaneous uploadsmax_file_uploads - this might also be important to set, to allow uploading many files at once.

Example of configuration file part:

post_max_size = 800M
upload_max_filesize = 799M max_file_uploads = 200

Check also setting of NGINX maximum POST size