Illuminate \ Http \ Exceptions \ PostTooLargeException

后端 未结 4 2061
情书的邮戳
情书的邮戳 2021-02-14 15:30

I already configured php.ini file (post_max_size=10240M), but it\'s still throwing PostTooLargeException. How to increase upload and download limit in Laravel 5.5?

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-14 15:59

    First, check your PHP version.

    php -v
    

    The command below will print the path to the php.ini file that your server is using.

    php -i | grep php.ini
    

    Next.

    sudo nano /etc/php/7.4/cli/php.ini
    

    The values of post_max_size, upload_max_filesize and memory_limit by default have the value of 8M, 2M, and 128M respectively.

    Search for those variables and change their values, whilst ensuring that the sizes follow the same ratio as the default values.

    See example below:

    post_max_size = 2G
    upload_max_filesize = 1G
    memory_limit = 3G
    

    For "heavy-loaded sites", it is useful to have FPM installed and running.

    sudo apt install php7.4-fpm -y
    sudo service php7.4-fpm start
    

    Finally, restart your web server.

    sudo service apache2 restart
    

提交回复
热议问题