在Heroku上部署Sylius应用程序时,所允许的内存大小为#字节

dfty9e19  于 2022-12-13  发布在  其他
关注(0)|答案(2)|浏览(135)

我正在尝试将Sylius应用程序部署到Heroku。在执行构建过程时失败,并出现以下错误:

...

remote:          - Installing doctrine/doctrine-migrations-bundle (2.1.2): Loading from cache
remote:          - Installing doctrine/doctrine-fixtures-bundle (v2.4.1): Loading from cache
remote:          - Installing sylius/sylius (v1.6.4): Loading from cache
remote:          - Installing symfony/dotenv (v4.4.1): Loading from cache
remote:        Generating optimized autoload files
remote:        ocramius/package-versions:  Generating version class...
remote:        ocramius/package-versions: ...done generating version class
remote:        Executing script cache:clear [KO]
remote:         [KO]
remote:        Script cache:clear returned with error code 1
remote:        !!
remote:        !!   // Clearing the cache for the prod environment with debug
remote:        !!   // false
remote:        !!
remote:        !!  PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /tmp/build_f92eb0b1353ebcf9e35e6d53f7853796/vendor/twig/twig/src/Node/Node.php on line 168
remote:        !!  PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 65536 bytes) in /tmp/build_f92eb0b1353ebcf9e35e6d53f7853796/vendor/composer/ClassLoader.php on line 444
remote:        !!
remote:        Script @auto-scripts was called via post-install-cmd
remote:
remote:  !     ERROR: Dependency installation failed!
remote:  !
remote:  !     The 'composer install' process failed with an error. The cause
remote:  !     may be the download or installation of packages, or a pre- or
remote:  !     post-install hook (e.g. a 'post-install-cmd' item in 'scripts')
remote:  !     in your 'composer.json'.
remote:  !
remote:  !     Typical error cases are out-of-date or missing parts of code,
remote:  !     timeouts when making external connections, or memory limits.
remote:  !
remote:  !     Check the above error output closely to determine the cause of
remote:  !     the problem, ensure the code you're pushing is functioning
remote:  !     properly, and that all local changes are committed correctly.
remote:  !
remote:  !     For more information on builds for PHP on Heroku, refer to
remote:  !     https://devcenter.heroku.com/articles/php-support
remote:
remote:  !     Push rejected, failed to compile PHP app.

我已经尝试了Heroku文档中建议的所有方法来增加内存限制https://devcenter.heroku.com/articles/php-concurrency#tuning-concurrency-using-memory_limit
但建议的方法都不会更改内存限制,内存限制仍为128 M,请参见错误:Allowed memory size of 134217728 bytes exhausted

  • 在根文档中找到了内容为memory_limit = 256M的用户.init。在我的示例/public中
  • 在根文档和顶级文件夹中找到fpm_costum.conf,内容为php_value[memory_limit] = 256M,将Procfile更改为:web: heroku-php-apache2 /public -F fpm_custom.conf

我没办法了...

roqulrg3

roqulrg31#

发生这种情况是因为您的限制没有传播到作为post脚本执行的cache:clear脚本。请尝试使用COMPOSER_MEMORY_LIMIT env变量:

COMPOSER_MEMORY_LIMIT=512M composer install …

请确保您没有覆盖public/index.php文件中的这个限制。这是我前段时间犯的错误...
要知道,几个更多的软件包,很快你将不得不增加这个价值高达一个演出。Sylius吃了很多RAM。

wvt8vs2t

wvt8vs2t2#

Composer还遵守由COMPOSER_MEMORY_LIMIT环境变量定义得内存限制:

COMPOSER_MEMORY_LIMIT=-1 composer update

相关问题