首页 > 解决方案 > Symfony 和学说问题

问题描述

在 symfony 中安装学说时我没有使用 sudo 所以这就是我得到的..

The "https://flex.symfony.com/aliases.json" file could not be downloaded: failed to open stream: Connection refused https://flex.symfony.com/aliases.json could not be fully loaded, package information was loaded from the local cache and may be out of date
to fix that i did this curl -XGET https://flex.symfony.com/aliases.json

然后我安装了 composer require symfony/orm-pack composer require --dev symfony/maker-bundle

问题是它不会在 env 文件中添加任何 db 配置......当我这样做时,composer require doctrine 我得到了这个

Pontuss-MacBook-Air:cauldron_overflow Pontus$ composer require doctrine
Using version ^1.0 for symfony/orm-pack
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "4.4.*"
Nothing to install or update
Package zendframework/zend-code is abandoned, you should avoid using it. Use laminas/laminas-code instead.
Package zendframework/zend-eventmanager is abandoned, you should avoid using it. Use laminas/laminas-eventmanager instead.
Generating autoload files
34 packages you are using are looking for funding.
Use thecomposer fundcommand to find out more!
ocramius/package-versions:  Generating version class...
ocramius/package-versions: ...done generating version class
Executing script cache:clear [OK]
Executing script assets:install public [OK]
Executing script security-checker security:check [OK]

那么为什么它不会将正确的数据添加到我的 env 文件中呢?请任何建议

标签: phpsymfony

解决方案


当您安装配方时,它会将一些示例数据安装到您的.env.dist文件中。

这仅适用于安装配方时的第一次运行。安装后,您可以做任何您想做的事并删除这些变量并从您的 Docker 中使用它。所以也许我不明白你的问题,因为你写了你不想在你的 env 文件中配置 db config,并且在最后一行你写它不会添加它。

https://symfony.com/doc/current/configuration.html

我知道你使用 flex,但是有一些很好的例子如何使用和如何去做。Flex 应该使用 DotEnv-Component。

最后一件事是您的错误(https://flex.symfony.com/aliases.json)。我认为您有阻止别名文件加载的防火墙。所以你必须先检查一下。如果您在浏览器中或使用 curl 运行它,该调用应该可以工作。否则,加载所有组件可能会出现问题。


推荐阅读