将 Symfony 2.5.7 部署到 heroku 云 - Class 'Doctrine\Bundle\DoctrineBundle\DoctrineBundle' 未找到
Deploying Symfony 2.5.7 to heroku cloud - Class 'Doctrine\Bundle\DoctrineBundle\DoctrineBundle' not found
我正在尝试将我的 Symfony 应用程序部署到 heroku,并且正在按照 Deploying to Heroku 教程进行操作。
但是,当我 push
我的代码到我的 heroku 应用程序时,heroku 无法编译我的应用程序,并且在从 composer.json
下载软件包后我收到以下消息:
Creating the "app/config/parameters.yml" file
PHP Fatal error: Class 'Doctrine\Bundle\DoctrineBundle\DoctrineBundle' not found in /tmp/build_45216c70c70215d5009d6aaa12fb90c1/app/AppKernel.php on line 16
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.
这是我composer.json
的内容:
...,
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.5.*",
"doctrine/orm": "~2.2,>=2.2.3",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~3.0",
"sensio/framework-extra-bundle": "~3.0",
"incenteev/composer-parameter-handler": "~2.0",
"braincrafted/bootstrap-bundle": "~2.1",
"twbs/bootstrap": "~3.3",
"symfony/serializer": "~2.6"
},
"require-dev": {
"sensio/generator-bundle": "~2.3"
},
"scripts": {
"post-root-package-install": [
"SymfonyStandard\Composer::hookRootPackageInstall"
],
"post-install-cmd": [
"Incenteev\ParameterHandler\ScriptHandler::buildParameters",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::removeSymfonyStandardFiles"
],
"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"
]
},
"config": {
"bin-dir": "bin"
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.5-dev"
}
}
当我在本地机器上安装供应商时,我可以在 vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DoctrineBundle.php
中找到 DoctrineBundle
class,所以我不明白这个错误:-(... .
谢谢
这是由于 Symfony 中的一个长期存在的问题,参见 https://github.com/symfony/symfony/pull/12784
您需要将 Symfony 升级到 2.5.8 或更新版本,或者 2.6.1 或更新版本。
还要确保在 heroku config
中将 SYMFONY_ENV
设置为 prod
。
我正在尝试将我的 Symfony 应用程序部署到 heroku,并且正在按照 Deploying to Heroku 教程进行操作。
但是,当我 push
我的代码到我的 heroku 应用程序时,heroku 无法编译我的应用程序,并且在从 composer.json
下载软件包后我收到以下消息:
Creating the "app/config/parameters.yml" file
PHP Fatal error: Class 'Doctrine\Bundle\DoctrineBundle\DoctrineBundle' not found in /tmp/build_45216c70c70215d5009d6aaa12fb90c1/app/AppKernel.php on line 16
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.
这是我composer.json
的内容:
...,
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.5.*",
"doctrine/orm": "~2.2,>=2.2.3",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~3.0",
"sensio/framework-extra-bundle": "~3.0",
"incenteev/composer-parameter-handler": "~2.0",
"braincrafted/bootstrap-bundle": "~2.1",
"twbs/bootstrap": "~3.3",
"symfony/serializer": "~2.6"
},
"require-dev": {
"sensio/generator-bundle": "~2.3"
},
"scripts": {
"post-root-package-install": [
"SymfonyStandard\Composer::hookRootPackageInstall"
],
"post-install-cmd": [
"Incenteev\ParameterHandler\ScriptHandler::buildParameters",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::removeSymfonyStandardFiles"
],
"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"
]
},
"config": {
"bin-dir": "bin"
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.5-dev"
}
}
当我在本地机器上安装供应商时,我可以在 vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DoctrineBundle.php
中找到 DoctrineBundle
class,所以我不明白这个错误:-(... .
谢谢
这是由于 Symfony 中的一个长期存在的问题,参见 https://github.com/symfony/symfony/pull/12784
您需要将 Symfony 升级到 2.5.8 或更新版本,或者 2.6.1 或更新版本。
还要确保在 heroku config
中将 SYMFONY_ENV
设置为 prod
。