Closed sinedoOo closed 1 day ago
Hi, Could you show your configuration and how did you test it? It would be helpful if you can make the php application as minimal as possible.
Actually it's very hard to share whole laravel application, coz it's pretty big, but basically I'm using default Laravel approach to retrieve uploaded file: https://laravel.com/docs/11.x/requests#retrieving-uploaded-files
And it's working just fine on Larvel Valet (preconfigured Nginx + PHP-FPM). So the code is totally fine.
I don't have anything special in unit configuration, but here it is:
{
"listeners": {
"*:443": {
"pass": "routes/public",
"tls": {
"certificate":"chain"
}
}
},
"routes": {
"public": [
{
"match": {
"uri": "!/index.php"
},
"action": {
"share": "/var/www/app/live/public$uri",
"response_headers": {
"Cache-Control": "public, max-age=31536000"
},
"fallback": {
"pass": "applications/laravel",
"response_headers": {
"X-Frame-Options": "SAMEORIGIN",
"X-Content-Type-Options": "nosniff"
}
}
}
}
]
},
"applications": {
"laravel": {
"type": "php",
"root": "/var/app/live/public/",
"script": "index.php",
"user": "app",
"group": "unit",
"limits": {
"timeout": 60
},
"processes": 50,
"options": {
"file": "/etc/php.ini",
"admin": {
"memory_limit": "256M",
"max_execution_time": "60"
}
}
}
}
}
Thanks for the report.
I tested the multiple file upload
with PHP but not Laravel
.
{
"listeners": {
"*:80": {
"pass": "routes"
}
},
"routes": [
{
"action": {
"share": "/tmp$uri",
"fallback": {
"pass": "applications/php"
}
}
}
],
"applications": {
"php": {
"type": "php",
"root": "/tmp",
"script": "index.php"
}
}
}
And its output is:
Array
(
[files] => Array
(
[name] => Array
(
[0] => test.txt
)
[full_path] => Array
(
[0] => test.txt
)
[type] => Array
(
[0] => text/plain
)
[tmp_name] => Array
(
[0] => /tmp/phpT8eyX6
)
[error] => Array
(
[0] => 0
)
[size] => Array
(
[0] => 3619
)
)
)
It looks like the PHP is running correctly with Unit.
I'd like to ask other team members familiar with Laravel to test again.
I don't know what happened, cannot logically explain it, but it was something super strange. After restarting the unit service few times now it started to work properly... so I guess we can close this issue. Sorry for bothering you :/
No bother at all, @sinedoOo. If you see the problem recur, please file another issue :)
I'm struggling with multipart file upload support for Laravel application. Basically file is not available from Laravel side at all. There are no errors in Unit logs, what's super strange. File is simply not passed to Laravel app at all. It's not max body size setting, because I already tried it. I think that this issue is connected to permission error with tmp directory. But unfortunately didn't find any information about how to configure it in official documentation. So questions: