Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Illuminate \ Http \ Exceptions \ PostTooLargeException

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?

like image 605
Prashant Gaurav Avatar asked Feb 03 '18 19:02

Prashant Gaurav


3 Answers

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
like image 107
Tumelo Mapheto Avatar answered Oct 16 '22 03:10

Tumelo Mapheto


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 ✅

like image 25
code-8 Avatar answered Oct 16 '22 01:10

code-8


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

like image 4
Md Johirul Islam Avatar answered Oct 16 '22 03:10

Md Johirul Islam