post_max_size = 5M checks if the whole post request is no bigger than 5M ... so if there is other stuff submitted than the image itself, your request will fail if the image is 5M or even a little less.
Why is upload_max_filesize set to 40G? You should set this one to 5M. This checks if the submitted image is not bigger than 5M.
http://laravel.com/docs/5.1/validation
You can also check the filesize with laravel, as well as use the "image" validator.