对于我的Symfony应用,我部署在heroku。
如果您使用heroku,请注意它使用git,composer,heroku toolbelt等运行。
要部署我的应用程序,我必须在上游(fork git workflow)合并我的pull-request。到目前为止,没有问题,一切正常。 一旦我合并了我的Pull请求,我就必须在分支上拉上游主服务器然后在heroku上推送这个分支,例如,使用以下命令:
git push prod my-branch:master
为了更准确地解释一下,当我在终端中git remote -v
时,这是我的git遥控器:
coworker https://github.com/my-coworker-repo/my-app.git (fetch)
coworker https://github.com/my-coworker-repo/my-app.git (push)
origin https://github.com/my-origin-repo/my-app.git (fetch)
origin https://github.com/my-origin-repo/my-app.git (push)
upstream https://github.com/my-company-account/my-app.git (fetch)
upstream https://github.com/my-company-account/my-app.git (push)
prod https://git.heroku.com/limitless-peak-.....git (fetch)
prod https://git.heroku.com/limitless-peak-.....git (push)
因此,当我想使用命令git push prod my-branch:master
发生此错误:
计数对象:41,完成。 Delta压缩最多使用4个线程。
压缩对象:100%(15/15),完成。书写对象:100% (15/15),1.49 KiB | 0字节/秒,完成。总计15(增量10),重复使用0 (delta 0)
remote:压缩源文件......完成。远程:建筑源: remote:remote:----->检测到远程的PHP应用程序:远程:!
警告:您的'composer.json'包含非'稳定'设置远程:'最小稳定性'。这可能会导致
的安装远程:此
期间运行时和扩展程序的不稳定版本部署。
remote:建议您始终使用稳定性标志 相反,
remote:即使您启用了'prefer-stable'也是如此。更多 信息,远程:见 https://getcomposer.org/doc/01-basic-usage.md#stability
远程:
遥控器:----->引导......
远程:
remote:gzip:stdin:不是gzip格式
remote:tar:Child返回状态1
remote:tar:错误无法恢复:现在退出
遥控器:!推送拒绝,无法编译PHP应用程序。
遥控器:遥控器:!推送失败
remote:验证部署...
远程:
遥控器:!推送被拒绝到我的应用程序。
远程:
致https://git.heroku.com/my-app.git! [远程拒绝] my-branch - > master(pre-receive hook拒绝)错误:不可能de pousser des référencesvers'https://git.heroku.com/my-app.git'
如果我运行作曲家更新或安装到我的heroku应用程序heroku run bash -r prod
我有一个运行时允许内存限制错误,但我不认为问题来自这个问题!
这是错误:
PHP致命错误:允许的内存大小为1073741824字节 (试图分配32个字节)in 药业:///app/.heroku/php/bin/composer/src/Composer/DependencyResolver/RuleWatchGraph.php 在第52行
致命错误:允许的内存大小为1073741824字节(已尝试 分配32个字节) 药业:///app/.heroku/php/bin/composer/src/Composer/DependencyResolver/RuleWatchGraph.php 在第52行
检查 https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors 有关如何处理内存不足错误的更多信息
这是我的composer.json文件:
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-4": { "": "src/" }
},
"minimum-stability": "alpha",
"prefer-stable": true,
"require": {
"php": "~5.6.0",
"ext-mbstring": "*",
"ext-mcrypt": "*",
"symfony/symfony": "2.7.*",
"doctrine/orm": "^2.4.8",
"doctrine/doctrine-bundle": "~1.4",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.8",
"sensio/distribution-bundle": "~4.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "~2.0",
"friendsofsymfony/user-bundle": "~2.0.0",
"knplabs/doctrine-behaviors": "~1.1",
"friendsofsymfony/jsrouting-bundle": "^1.5",
"jms/serializer-bundle": "^1.1",
"genemu/form-bundle": "2.2.*",
"elao/web-profiler-extra-bundle" : "~2.3",
"a2lix/translation-form-bundle": "^2.0",
"ircmaxell/password-compat": "~1.0",
"vich/uploader-bundle": "^0.14.0",
"liip/imagine-bundle": "^1.4",
"doctrine/data-fixtures": "^1.1",
"league/geotools": "@stable",
"winzou/state-machine-bundle": "~0.2.2",
"doctrine/doctrine-fixtures-bundle": "~2.2",
"muka/shape-reader": "dev-master",
"league/csv": "^8.0",
"ronanguilloux/isocodes": "^2.0",
"liuggio/excelbundle": "~2.0",
"presta/sitemap-bundle": "dev-master",
"liip/doctrine-cache-bundle": "^1.0",
"evheniy/robots-txt-bundle": "1.*",
"php-amqplib/rabbitmq-bundle": "^1.9",
"icicleio/icicle": "^0.9.6"
},
"require-dev": {
"sensio/generator-bundle": "~2.3",
"heroku/heroku-buildpack-php": "*"
},
"scripts": {
"pre-install-cmd": [
"BetonDirect\\EntityBundle\\HerokuDatabase::populateEnvironment"
],
"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::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::prepareDeploymentTarget"
],
"compile": [
"php app/console assetic:dump --no-debug"
]
},
"config": {
"bin-dir": "bin"
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"symfony-assets-install": "hard-copy",
"incenteev-parameters": {
"file": "app/config/parameters.yml",
},
"branch-alias": {
"dev-master": "2.7-dev"
},
"heroku": {
"php-config": [
"date.timezone=Europe/Paris"
]
}
}
}
你知道问题出在哪里吗?
此外,我已经使用相同的配置将我的应用程序与heroku部署(相同的方法描述如下),我以前没有此错误。
当我进入heroku日志页面时,我有这个:
2016-07-22T15:07:11.164523+00:00 heroku[slug-compiler]: Slug compilation started
如果我继续使用heroku构建日志视图,我会遇到与终端e-g相同的错误:
-----> PHP app detected
! WARNING: Your 'composer.json' contains a non-'stable' setting
for 'minimum-stability'. This may cause the installation of
unstable versions of runtimes and extensions during this deploy.
It is recommended that you always use stability flags instead,
even if you have 'prefer-stable' enabled. For more information,
see https://getcomposer.org/doc/01-basic-usage.md#stability
-----> Bootstrapping...
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
! Push rejected, failed to compile PHP app.
! Push failed
答案 0 :(得分:1)
PHP致命错误:第52行的phar:///app/.heroku/php/bin/composer/src/Composer/DependencyResolver/RuleWatchGraph.php中允许的内存大小为1073741824字节(尝试分配32个字节)
致命错误:在第52行的phar:///app/.heroku/php/bin/composer/src/Composer/DependencyResolver/RuleWatchGraph.php中,允许的内存大小为1073741824字节(试图分配32个字节)< / p>
检查https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors以获取有关如何处理内存不足错误的更多信息
内存限制错误是由您在dyno上运行composer引起的。 dynos本身可以有512MB或1GB的RAM,没有启用交换。
当Heroku处理你的Git推送时,Composer实际上是在一个特殊的,更强大的实例上运行,拥有更多资源,因此Composer不会在那里耗尽内存。对于具有许多依赖关系的应用程序,Composer需要在GB RAM的北部运行才是完全正常的。
答案 1 :(得分:0)
我找到了解决方案。问题来自heroku-buildpacks-PHP
确实,我必须在本地更新此repo,然后将他推送到我的heroku-app(直接在我的遥控器上),以便正确编译php并在heroku服务器上部署我的应用程序。