Working locally after cloning Craft 3 from Hyperlane I'm trying out the recommended Hyperlane hosting with Craft CMS. After installing on Hyperlane, I then clone the repo on to my local machine and run 'composer install'. That runs fine, and I create a .env file with my db connection details in it.

What happens next is I go to install on my machine by viewing the admin panel but I get the following:

Database Connection Error – craft\errors\DbConnectException
Craft CMS can’t connect to the database with the credentials in config/db.php.
↵
Caused by: Invalid Configuration – yii\base\InvalidConfigException
Connection::dsn cannot be empty.
in C:\Users\clive\OneDrive\Desktop\repos\projectname\vendor\yiisoft\yii2\db\Connection.php at line 602


If I add the database details to config/db.php myself, it works fine. It just seems to be a problem with fetching them from .env.

I'm using WAMP on Windows and have numerous Craft 3 projects already running. This same project is fine if I install locally from scratch. It's just when I start by cloning from Hyperlane.

Any ideas?
Solved. The config/db.php cloned from Hyperlane refers to different env variable names than those used within my .env file. Changing the names in config/db.php solved the issue.

Before:

return [
    'driver' =&gt; getenv('DB_DRIVER'),
    'server' =&gt; getenv('DB_HOST'),
    'user' =&gt; getenv('DB_USER'),
    'password' =&gt; getenv('DB_PASSWORD'),
    'database' =&gt; getenv('DB_NAME'),
    'schema' =&gt; getenv('DB_SCHEMA'),
    'tablePrefix' =&gt; getenv('DB_TABLE_PREFIX'),
    'port' =&gt; getenv('DB_PORT')
];


After:

return [
    'driver' =&gt; getenv('DB_DRIVER'),
    'server' =&gt; getenv('DB_SERVER'), // changed
    'user' =&gt; getenv('DB_USER'),
    'password' =&gt; getenv('DB_PASSWORD'),
    'database' =&gt; getenv('DB_DATABASE'), // changed
    'schema' =&gt; getenv('DB_SCHEMA'),
    'tablePrefix' =&gt; getenv('DB_TABLE_PREFIX'),
    'port' =&gt; getenv('DB_PORT')
];