I’m writing this here to help future users trying to install in a configuration similar as mine, and eventually to notify nextcloud devs that the setup-nextcloud.php script could probably be improved.
In order to make it work, I had to tinker a bit with the environment. First, despite the dependency checks made by setup-nextcloud, there were a few php modules missing that went unnoticed, but that made the install fail:
(The session and filter modules, in particular, aren’t checked, aren’t mentioned anywhere, but are necessary - I guess they come standard in linux distributions, but they are optional in freebsd).
(for completeness, here is what “php -m” spits out on my config):
I laso had to manually create the nextcloud/data folder. I don’t know why.
Lastly, at some point, I renamed both the “www” user and group to “www-data”, but I don’t think this was actually necessary. I tried that as an attempt to make nextcould create the data folder properly.
Now it seems to work