When running composer install --no-dev --optimize-autoloader -vvv, the command php -d allow_url_fopen='1' -d disable_functions='' -d memory_limit='1536M' artisan package:discover --ansi is also run.
Because this loads the service providers, a database connection will be attempted for the configuration items. When, for example, building your code base on a CI/CD server, this will hang until a timeout because it cannot connect to the database.
What is the expected result?
Avoid a database connection during artisan/build commands.
What steps will reproduce the problem?
When running
composer install --no-dev --optimize-autoloader -vvv
, the commandphp -d allow_url_fopen='1' -d disable_functions='' -d memory_limit='1536M' artisan package:discover --ansi
is also run.Because this loads the service providers, a database connection will be attempted for the configuration items. When, for example, building your code base on a CI/CD server, this will hang until a timeout because it cannot connect to the database.
What is the expected result?
Avoid a database connection during artisan/build commands.
What do you get instead?
Timeout on database connections.
Additional info