Word Count: 149
  • Post category:Codings / Servers
  • Post last modified:2024-04-04

Debian 12

When MJ1900 was upgraded to Debian 12 in 2023, the php version for Apache has been changed to php8.2-fpm service. To adjust the max upload filesize, edit the file /etc/php/8.2/fpm/php.ini to update the directives as described in section below.

Restart php-fpm to effect the changes by issuing this command: # systemctl restart php8.2-fpm

Prior to Debain 12

In php.ini for Apache2 (e.g. /etc/php/7.3/apache2/php.ini), make a backup copy, then locate the following directives and change the values:

memory_limit 1000M
post_max_size 900M
upload_max_filesize 750M
max_file_uploads 200

max_execution_time 300
max_input_time 300

Restart Apache to take effect : # systemctl restart apache2

Important Notes

  • memory_limit:執行每個 scripts 時使用的 memory 大小限制, 這個 memory_limit 必須大於 post_max_size
  • post_max_size:PHP允許一次上傳檔案的大小限制(一次多個檔案的總合) 這個 post_max_size 必須大於 upload_max_filesize(要上傳課程包建議設成2000M)
  • upload_max_filesize: 這是上傳單一檔案的大小限制(要上傳課程包建議設成900M)
  • 這三個數值的大小,必須是 memory_limit > post_max_size > upload_max_filesize