So far, I have pretty much done everything to eliminate possibilities and the conclusion I have come to is that the
.env file isn't being loaded. Obviously, I could well be wrong, but I tried a
Hello World on the
db.php file and it worked. I put the database details directly into the
db.php file and it worked, albeit took me to the current install rather than the upgrade page. I even created a new database (just to try it) and still got the same error.
The db file looks like this:
<?php /** * Database Configuration * * All of your system's database connection settings go in here. You can see a * list of the available settings in vendor/craftcms/cms/src/config/DbConfig.php. * * @see craft\config\DbConfig */ return [ 'driver' => getenv('DB_DRIVER'), 'server' => getenv('DB_SERVER'), 'user' => getenv('DB_USER'), 'password' => getenv('DB_PASSWORD'), 'database' => getenv('DB_DATABASE'), 'schema' => getenv('DB_SCHEMA'), 'tablePrefix' => getenv('DB_TABLE_PREFIX'), 'port' => getenv('DB_PORT') ];
And the env file:
# The environment Craft is currently running in ('dev', 'staging', 'production', etc.) ENVIRONMENT="dev" # The secure key Craft will use for hashing and encrypting data SECURITY_KEY="*************" # The database driver that will be used ('mysql' or 'pgsql') DB_DRIVER="mysql" # The database server name or IP address (usually this is 'localhost' or '127.0.0.1') DB_SERVER="localhost" # The database username to connect with DB_USER="####" # The database password to connect with DB_PASSWORD="**************" # The name of the database to select DB_DATABASE="####" # The database schema that will be used (PostgreSQL only) DB_SCHEMA="public" # The prefix that should be added to generated table names (only necessary if multiple things are sharing the same database) DB_TABLE_PREFIX="craft" # The port to connect to the database with. Will default to 5432 for PostgreSQL and 3306 for MySQL. DB_PORT="3306"
Can anyone shed anymore light on how I can resolve this please? I am new to this so please be gentle and let me know if you need more info. Thanks.