PHP编写器安装问题
我在使用php composer时遇到了一个大问题,我运行了这个命令PHP编写器安装问题,php,symfony,composer-php,Php,Symfony,Composer Php,我在使用php composer时遇到了一个大问题,我运行了这个命令 php composer.phar install 但它告诉我这个错误 Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception [RuntimeException] An error occu
php composer.phar install
但它告诉我这个错误
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:
PHP Warning: require_once(/var/www/lcp-api/app/bootstrap.php.cache): failed to open stream: No such file or directory in /var/www/lcp-api/app/console on line 10
PHP Fatal error: require_once(): Failed opening required '/var/www/lcp-api/app/bootstrap.php.cache' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/
lcp-api/app/console on line 10
.
我检查了composer.json文件,似乎一切正常
"post-install-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
],
"post-update-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
]
},
你知道我为什么会犯这个错误吗
诚恳地说,您的bootstrap.php.cache文件似乎丢失了。Symfony有时会发生这种情况
如果运行composer update而不是install,则应重新生成该文件。如果不起作用,可以从项目根目录运行以下命令手动生成:
php vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php
如果这也不起作用,您可以尝试通过如下方式运行composer将环境强制为生产模式:
SYMFONY_ENV=prod composer install
请记住,如果在开发环境中这样做,调试模式将被禁用。这将生成一个bootstrap.php.cache文件,这样您就可以再次在开发模式下重新运行composer。文件/var/www/lcp-api/app/bootstrap.php.cache是否存在?不,这就是问题所在,我没有这个文件。我查看了其他帖子,他们说Symphony生成了它。当我运行第二个命令时,我得到了这个v2.1.62。你知道它的意思吗?这很奇怪,如果一切顺利,build_bootstrap应该不会给出任何输出。这不是Symfony或Sensio的版本号,因为他们的2.1.x版本没有达到62。您使用的是Symfony的最新版本吗?如果您被困在2上,我们将升级到版本3.3.9或2.8.27。我无法在任何一个版本上复制这种行为。