yellowsubmarine's avatar

Big file upload fails without verbose error message

I am using Laravel 10 + Nova 4.

Moved my application to the server and when I try to upload larger file with:

File::make(__('models.document.file.label'), 'path')
->help(__('models.document.file.help'))
->disk('documents')

I get this error message that gives 0 context:

There was a problem submitting the form. " "

Note that there is open quotes but nothing inside them. Laravel.log is also empty, no error is showing there.

I must say that files less then 2mb upload fine. This gave me idea to update php.ini file which I did:

upload_max_filesize => 256M => 256M
post_max_size => 256M => 256M

But this changes nothing.. I am still unable to upload bigger files..

Do you have some other idea? How can I debug Laravel Nova file upload?

0 likes
17 replies
JussiMannisto's avatar
Level 50

If you're running php-fpm, you need to restart the service for those php.ini changes to take place.

post_max_size should be bigger than upload_max_filesize.

yellowsubmarine's avatar

@JussiMannisto Hello and thank you for your reply.

I did restart with this command:

systemctl restart apache2.service

But unfortunately without any change... still bumping into same issue.

Testing this 2nd proposal: post_max_size should be bigger than upload_max_filesize.

yellowsubmarine's avatar

@JussiMannisto

I have changed php.ini values to:

post_max_size => 2048M => 2048M
upload_max_filesize => 256M => 256M

Without any success...

JussiMannisto's avatar

@yellowsubmarine That's apache, not php-fpm. I don't know how you're running PHP, but you can check if it's fpm by running this:

ps aux | grep php-fpm

If you see any processes (except for grep), then you're using php-fpm. You need to restart it like so:

sudo systemctl restart php-fpm

Or whatever the service name is in your system, e.g. php8.3-fpm.

I hope you adjust those settings to more sensible values after you're done. I don't think you want to allow 2GB post payloads...

yellowsubmarine's avatar

@JussiMannisto

Ah, well this is new to me..

ps aux | grep php-fpm returns this:

root         509  0.0  0.1 222128 29948 ?        Ss   Jul12   0:32 php-fpm: master process (/etc/php/8.1/fpm/php-fpm.conf)
root         510  0.0  0.1 223780 30348 ?        Ss   Jul12   0:32 php-fpm: master process (/etc/php/8.3/fpm/php-fpm.conf)
www-data     779  0.0  0.0 222568 11244 ?        S    Jul12   0:00 php-fpm: pool www
www-data     780  0.0  0.0 222568 11244 ?        S    Jul12   0:00 php-fpm: pool www
www-data     782  0.0  0.0 224232 11612 ?        S    Jul12   0:00 php-fpm: pool www
www-data     783  0.0  0.0 224232 11612 ?        S    Jul12   0:00 php-fpm: pool www
root     2813247  0.0  0.0   8164  2488 pts/0    S+   15:59   0:00 grep --color=auto php-fpm

Can you please confirm if I should follow php-fpm restart?

JussiMannisto's avatar

@yellowsubmarine What are these arrow things: post_max_size => 2048M => 2048M? That's not how you set a value in the ini file.

Also, you need to change those settings in the right ini file. If you change them in the CLI ini file (used in the command line), then they won't apply to FPM (used by the web server), and vice-versa.

What is the path of the ini file that you're editing?

yellowsubmarine's avatar

@JussiMannisto

OH... Those are indeed changed in CLI ini file.. ( /etc/php/8.1/cli/php.ini )

So if I understand you correctly I should be changing /etc/php/8.1/fpm/php.ini?

And after change I should restart fpm with:

sudo systemctl restart php-fpm

"What are these arrow things: post_max_size => 2048M => 2048M? That's not how you set a value in the ini file."

I am not server person and I have picked after someone who told me that they changed all this values for me. I am doing this myself out of frustration so I just change the numbers.. Arrows were there actually.

Thank you for your time!

JussiMannisto's avatar

@yellowsubmarine Let's start with some slightly more reasonable values. Edit these values to php.ini under the fpm/ directory:

post_max_size = 128M
upload_max_filesize = 100M

Also make sure that the memory_limit directive is something bigger than post_max_size:

memory_limit = 150M

Then you should restart the fpm process. Try running:

sudo systemctl restart php-fpm

If that doesn't work, the service is named something different. Replace php-fpm with php8.1-fpm and try again. You should find the name of the service somewhere under the /run/ directory.

yellowsubmarine's avatar

@JussiMannisto

Did everything as you said but still no luck...

  • Changed the php.ini under /etc/php/8.1/fpm/ directory with next:
post_max_size = 128M
upload_max_filesize = 100M
memory_limit = 150M
  • Restarted php8.1-fpm
sudo systemctl restart php8.1-fpm

I apreciate your help but if you got any more suggestion/s please let me know..

JussiMannisto's avatar

@yellowsubmarine What happens now when you try to upload? Do you see anything in Laravel's log file? What about the web server log?

But first, add this URL to your routes and open it in a browser:

Route::get('/check-settings', function() {
	phpinfo();
});

That will output all PHP settings. Check that the settings you changed have been applied correctly (post_max_size etc.).

1 like
yellowsubmarine's avatar

@JussiMannisto

You are on the right track, added route and checked it via browsers. Changes are not applied to values I have changed. They are still. upload_max_filesize = 2M, post_max_size = 8M...

What could be the reason?

yellowsubmarine's avatar

Providing this because it could help:

phpinfo(); returns this 3 lines:

Configuration File (php.ini) Path /etc/php/8.1/apache2 Loaded Configuration File /etc/php/8.1/apache2/php.ini Scan this dir for additional .ini files /etc/php/8.1/apache2/conf.d

Does this mean that I shell change "/etc/php/8.1/apache2/php.ini"?

yellowsubmarine's avatar

@JussiMannisto

Aaaaa - It works now!

Thank you very much for your help & patience... I have learned something today and you saved me a lot of time - Please let me know if you got Patreon or some other way I can buy you a beer/juice!

Regards!

JussiMannisto's avatar

@yellowsubmarine No problem. You can mark one of the answers as the best answer so that the thread gets a 'solved' badge. Also remember to remove the /check-settings route.

Please or to participate in this conversation.