Laravel file uploads failing when file size is larger than 2mb

Question:

I launched an early beta site yesterday. It’s vrep.io and I faced a strange problem. When uploading images (user avatars) larger than 2mb laravel validator returns “validation.uploaded” error message.

validator code:

I changed the current php.ini file parameters:

It’s running on AWS EC2 instance. UBUNTU 16.04 and Nginx.

I have also made changes in nginx config file:

Restarted nginx and php and even restarted the whole web server. No effect. Still the same error when uploading files larger than 2mb.

p.s. I run homestead locally and file uploads work without any issues. The problem is only on production server.

What did I miss there?

Answer:

I do not know how but even if I am searching for an answer the whole day I am finally finding solution in a few minutes after posting here. There’s some magic going on on SO.
So I was editing the wrong php.ini file. I was checking which php ini file was used like this via ssh:

But it was showing the wrong file there. Actual configuration file was different for some reason.

Now I dumped php info:

Found the actual config file and everything works. Hope this will help somebody.

Leave a Reply