This seem to not work :)))
The .env file is in /home/user/.config/.env
The Webspace is /home/user/webroot/public_html
// this code is in /home/user/webroot/public_html/index.php
$envfile = realpath(__DIR__ .'/../../.config/'); // is /home/user/.config/
$dotenv = Dotenv\Dotenv::createImmutable($envfile);
This seem to not work :))) The .env file is in
/home/user/.config/.env
The Webspace is/home/user/webroot/public_html