Composer安装Symfony 3.4-bootstrap.php.cache

时间:2018-11-14 14:20:09

标签: php symfony nginx doctrine

在安装项目期间,我必须安装和更新我的作曲家。但是我做不到,因为作曲家告诉我:

> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache

Warning: require_once(C:\Projects\private\p1\../app/bootstrap.php.cache): failed to open stream: No such file or directory in C:\Projects\private\p1\bin\console on line 11

Fatal error: require_once(): Failed opening required 'C:\Projects\private\p1\bin/../app/bootstrap.php.cache' (include_path='.;C:\php\pear') in C:\Projects\private\p1\bin\console on line 11
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception


  [RuntimeException]
  An error occurred when executing the ""cache:clear --no-warmup"" command:


  Warning: require_once(C:\Projects\private\p1\bin/../app/bootstrap.php.cache): failed to open stream
  : No such file or directory in C:\Projects\private\p1\bin\console on line 11

  Fatal error: require_once(): Failed opening required 'C:\Projects\private\p1\bin/../app/bootstrap.php.cache' (include_path='.;C:\php\pear') in C:\Projects\private\p1\bin\console on line 11

我已经搜索了2天的答案,并且尝试了所有可以在互联网上看到的内容...

我不知道您是否还需要其他东西,请帮助我

2 个答案:

答案 0 :(得分:1)

如果由于不同原因未创建bootstrap.php.cache文件。通常,应在项目目录中运行composer install后生成它。

如果需要手动生成,只需在Symfony项目文件夹中运行以下命令:

php vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php

如果具有新的Symfony 3文件夹结构,则需要添加三个参数:

php vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php var app new

该文件将在var / bootstrap.php.cache中生成,而不是在app / bootstrap.php.cache中生成。

答案 1 :(得分:0)

解决问题的步骤:

  1. 运行此命令:bin/console cache:clear --env=prod
  2. 运行此chown www-data:www-data projectDirectory
  3. 运行此命令SYMFONY_ENV=prod composer install --no-dev -o --prefer-dist
  4. 运行此命令chown www-data:www-data projectDirectory