Heroku Symfony 3.2 Push 被拒绝,无法编译 PHP 应用程序

Posted

技术标签:

【中文标题】Heroku Symfony 3.2 Push 被拒绝,无法编译 PHP 应用程序【英文标题】:Heroku Symfony 3.2 Push rejected, failed to compile PHP app 【发布时间】:2017-04-27 22:30:11 【问题描述】:

我在 heroku 上部署我的 symfony 网络应用程序时遇到了问题,而以前它工作得很好。有什么问题? 这是构建日志:http://pastebin.com/DXZH110S

这是日志的相关部分:

生成优化的自动加载文件

Incenteev\ParameterHandler\ScriptHandler::buildParameters 创建“app/config/parameters.yml”文件 Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache php 致命错误:未捕获的 Symfony\Component\Debug\Exception\ClassNotFoundException:试图从命名空间“Sensio\Bundle\GeneratorBundle”加载类“SensioGeneratorBundle”。 您是否忘记了另一个名称空间的“使用”语句?在 /tmp/build_d39105bc4146e68631d1261a1ca2a632/izio7-YourTeam-15b2d72/app/AppKernel.php:25 堆栈跟踪: #0 /tmp/build_d39105bc4146e68631d1261a1ca2a632/izio7-YourTeam-15b2d72/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(403): AppKernel->registerBundles() #1 /tmp/build_d39105bc4146e68631d1261a1ca2a632/izio7-YourTeam-15b2d72/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(113): Symfony\Component\HttpKernel\Kernel->initializeBundles() #2 /tmp/build_d39105bc4146e68631d1261a1ca2a632/izio7-YourTeam-15b2d72/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(68): Symfony\Component\HttpKernel\Kernel->boot() #3 / TMP / build_d39105bc4146e68631d1261a1ca2a632 / izio7-YourTeam-15b2d72 /供应商/ symfony的/ symfony的/ SRC / Symfony的/组件/控制台/ APPLI在/tmp/build_d39105bc4146e68631d1261a1ca2a632/izio7-YourTeam-15b2d72/app/AppKernel.php在线25上 处理 symfony-scripts 事件的脚本 Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache 因异常而终止

 [RuntimeException]                                                                                                                                                                                                                  
 An error occurred when executing the "'cache:clear --no-warmup'" command:                                                                                                                                                            
 PHP Fatal error:  Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "SensioGeneratorBundle" from namespace "Sensio\Bundle\GeneratorBundle".                                                
 Did you forget a "use" statement for another namespace? in /tmp/build_d39105bc4146e68631d1261a1ca2a632/izio7-YourTeam-15b2d72/app/AppKernel.php:25                                                                                  
 Stack trace:                                                                                                                                                                                                                        
 #0 /tmp/build_d39105bc4146e68631d1261a1ca2a632/izio7-YourTeam-15b2d72/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(403): AppKernel->registerBundles()                                                          
 #1 /tmp/build_d39105bc4146e68631d1261a1ca2a632/izio7-YourTeam-15b2d72/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(113): Symfony\Component\HttpKernel\Kernel->initializeBundles()                              
 #2 /tmp/build_d39105bc4146e68631d1261a1ca2a632/izio7-YourTeam-15b2d72/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(68): Symfony\Component\HttpKernel\Kernel->boot()                            
 #3 /tmp/build_d39105bc4146e68631d1261a1ca2a632/izio7-YourTeam-15b2d72/vendor/symfony/symfony/src/Symfony/Component/Console/Appli in /tmp/build_d39105bc4146e68631d1261a1ca2a632/izio7-YourTeam-15b2d72/app/AppKernel.php on line 25

【问题讨论】:

我建议在此处粘贴构建日志的相关部分,以及您为解决出现的任何错误而采取的步骤,否则这里没有太多内容可做。 【参考方案1】:

最后我解决了,问题是系统变量 SYMFONY_ENV=prod 没有设置。 https://devcenter.heroku.com/articles/getting-started-with-symfony#configuring-symfony-to-run-in-the-prod-environment

【讨论】:

以上是关于Heroku Symfony 3.2 Push 被拒绝,无法编译 PHP 应用程序的主要内容,如果未能解决你的问题,请参考以下文章

Symfony 4:在Heroku上设置可信代理

git push heroku master:Heroku push 被拒绝,没有检测到 Cedar 支持的应用程序

git push heroku master错误权限被拒绝(公钥)[重复]

heroku push 被拒绝,无法编译 Node.js 应用程序

node-pre-gyp:heroku push 中的权限被拒绝

node-pre-gyp:heroku push 中的权限被拒绝