Illuminate \\ Http \\ Exceptions \\ PostTooLargeEx

2019-04-11 10:23发布

问题:

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?

回答1:

First, check your php version

php --version 


PHP 7.2.7-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Jun 22 2018 08:44:50) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.7-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

if your php version is 7.2

open this file /etc/php/7.2/fpm/php.ini

Update these 2 fields to something that big enough. Ex. 1024M or 2048M

post_max_size = 1024M                                                                                                            
upload_max_filesize = 1024M  

Restart the php

service php7.2-fpm restart

Done ✅



回答2:

You may try the following code in your php.ini file to increase the memory limit.

 ini_set('memory_limit','10240M');
 # Do your Intervention operations...

You may also be interested to read https://laracasts.com/discuss/channels/servers/interventionimage-memory-limit?page=1