The maximum allowed size for file uploads in PHP are defined by the upload_max_filesize directive. As file uploads are normally done using HTTP POST method, it is also limited by the post_max_size value.
Maximum size of POST data that PHP will accept.
Its value may be 0 to disable the limit. It is ignored if POST data reading is disabled through enable_post_data_reading.
Maximum allowed size for uploaded files.
This means the actual maximum upload file size for PHP is bound to the lowest value of both post_max_size and upload_max_filesize.
You can increase the maximum upload file size for your PHP applications by updating these two directives in your PHP configuration file to the values that fit your requirement and then restart your web server.
$ sudo vi /etc/php/7.4/apache2/php.ini
; Maximum allowed size for uploaded files. ; http://php.net/upload-max-filesize upload_max_filesize = 2M
upload_max_filesize = 128M
; Maximum size of POST data that PHP will accept. ; Its value may be 0 to disable the limit. It is ignored if POST data reading ; is disabled through enable_post_data_reading. ; http://php.net/post-max-size post_max_size = 8M
post_max_size = 128M
This value should be set at least as high as upload_max_filesize value. Set the value to 0 to impose no limit on the size.
Alternatively, you can add the following lines in your .htaccess and the setting will apply to scripts from within the .htaccess' directory without having to mess with PHP's configuration.
php_value upload_max_filesize 128M php_value post_max_size 128M
Comment anonymously. Login not required.