magento2: Magento 2 CLI Installation fails
Preconditions (*)
- Have GiT installed
- Have docker installed
- Clone the magento2 project with branch (2.4-develop, commit: ad2945209811dc9fb5cd531af8f2a2bace8647f3)
- Have PHP CLI version 7.4.10 installed
- Have MariaDB Percona Server 5.7.32-35 installed
Steps to reproduce (*)
- Create an mariadb and php docker image
- Configure Magento to use proper credentials/hosts
- Run
composer install - Run
bin/magento setup:install(or follow command(s) in https://devdocs.magento.com/guides/v2.4/install-gde/install/cli/install-cli-install.html or https://devdocs.magento.com/guides/v2.4/install-gde/install/cli/install-cli-subcommands.html)
Expected result (*)
- Magento 2 installs or fails on missing parameters.
Actual result (*)
- The installation fails on step 4 with “The default website isn’t defined. Set the website and try again.”

What I have done so far:
- Clear all cache
- Try a different setup command (see links step 3 reproduce)
- Re-create database
- Composer install without dev packages
It appears to be related to https://github.com/magento/magento2/issues/27864 and https://github.com/magento/magento2/issues/15196 and maybe https://github.com/justbetter/magento2-sentry/issues/23
It is also important to note that when the install fails the database is still empty and no tables have been created yet.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 3
- Comments: 20 (4 by maintainers)
I just ran into almost the same; with a little different setup. I’m using the containers found here, but the error was identical. It appears to have fixed itself after I ran
bin/magento setup:db-schema:upgrade, which will fail, but then thesetup:installcommand will suddenly work…I’ve found a way to make it work (it’s a workaround rather than an actual solution) :
(2factor auth is kept disabled for local developements purposes)
@manobi I’ve same issue with PHP 7.4.15 run
bin/magento setup:upgradeI reverted to using PHP 7.3, all worked fine.
Hello thank you for checking it out. A configured
env.phpis needed for the database config (I should have added it, nice catch) and that is it. Once it reaches step 4 out of 841 it fails with the exact same error I just tested it with the latest 2.4-develop and the issue still exists.Which version of php/db did you use? Maybe the issue is related to that? Or maybe it is a container specific issue.
That does indeed work as a quick fix, thank you for that. I still believe it should have some investigation because why does the setup try to access database values before the database is set-up?