gpt4 book ai didi

php - 共享主机上的 Composer 内存耗尽

转载 作者:可可西里 更新时间:2023-11-01 12:27:38 26 4
gpt4 key购买 nike

以前在共享 FreeBSD 主机上运行的沙箱现在无法运行 composer update 或安装,并出现内存耗尽错误。在昨天之前,我能够毫无问题地运行 php ./composer.phar update。我不认为需要更多内存。我可以毫无问题地在 Windows 系统上更新项目。除内存大小外,还有哪些变量会导致内存耗尽错误?

为了测试这一点,我将 .../vendor 的内容和 composer.lock 文件移动到不同的目录,然后运行 ​​php ./composer.phar install --prefer-dist。 [Composer 在项目目录中,这样我就可以在本地更新它,而不是期望主机 master 保持更新。] 上面的命令结果为:

% php ./composer.phar install --prefer-dist
Loading composer repositories with package information
Updating dependencies (including require-dev)
PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 134217728 bytes) in phar:///home/projectmana/www3.projectmana.org/composer.phar/src/Composer/DependencyResolver/Solver.php on line 220

Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 134217728 bytes) in phar:///home/projectmana/www3.projectmana.org/composer.phar/src/Composer/DependencyResolver/Solver.php on line 220

Composer 是 1.20 版本

使用的 composer.json:

{
"name": "truckee/projectmana",
"license": "MIT",
"type": "project",
"description": "Project MANA administrative application",
"autoload": {
"psr-0": {
"": "src/"
}
},
"repositories": [
{
"type": "package",
"package": {
"name": "jquery/jquery",
"version": "1.11.1",
"dist": {
"url": "https://code.jquery.com/jquery-1.11.1.js",
"type": "file"
}
}
}
],
"require": {
"braincrafted/bootstrap-bundle": "~2.0",
"doctrine/doctrine-bundle": "~1.4",
"doctrine/doctrine-fixtures-bundle": "^2.3",
"doctrine/orm": "^2.4.8",
"friendsofsymfony/user-bundle": "~2.0@dev",
"incenteev/composer-parameter-handler": "~2.0",
"javiereguiluz/easyadmin-bundle": "~1.1",
"jms/security-extra-bundle": "~1.5",
"jquery/jquery": "1.11.*",
"knplabs/knp-menu-bundle": "~2.0",
"nelmio/alice": "^2.1",
"oyejorge/less.php": "~1.5",
"paragonie/random_compat": "^2.0",
"php": ">=5.3.9",
"psliwa/pdf-bundle": "dev-master",
"sensio/distribution-bundle": "~4.0",
"sensio/framework-extra-bundle": "^3.0.2",
"symfony/assetic-bundle": "dev-master",
"symfony/monolog-bundle": "~2.4",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/symfony": "2.8.*",
"twbs/bootstrap": "3.0.*",
"twig/extensions": "1.0.*"
},
"scripts": {
"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",
"Braincrafted\\Bundle\\BootstrapBundle\\Composer\\ScriptHandler::install"
],
"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",
"Braincrafted\\Bundle\\BootstrapBundle\\Composer\\ScriptHandler::install"
]
},
"config": {
"bin-dir": "bin"
},
"minimum-stability": "stable",
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "htdocs",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.3-dev"
},
"repositories": [
{
"type": "composer",
"url": "http://packages.zendframework.com/"
},
{
"type": "composer",
"url": "http://packagist.org/"
}
]
},
"require-dev": {
"liip/functional-test-bundle": "^1.4",
"symfony/phpunit-bridge": "^3.0"
}
}

编辑:可用内存:

% php -r "echo(ini_get('memory_limit'));"
128M

请求free -m:% 自由-m免费:找不到命令。

使用 -vv --profile:

% composer update -vv --profile
[9.9MB/0.01s] Loading composer repositories with package information
[10.5MB/0.80s] Updating dependencies (including require-dev)
PHP Fatal error: ...

编辑 #2, fatal error (使用 composer 1.1.0)继续,因为它与上面的不同:

Allowed memory size of 1073741824 bytes exhausted (tried to allocate 32 bytes) in phar:///usr/local/bin/composer.phar/src/Composer/DependencyResolver/RuleWatchGraph.php on line 52

Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 32 bytes) in phar:///usr/local/bin/composer.phar/src/Composer/DependencyResolver/RuleWatchGraph.php on line 52

最佳答案

你可以试试这个,我成功了

php -d memory_limit=-1 /usr/local/bin/composer/composer.phar require guzzlehttp/guzzle

这是我的第一个答案!!!哇

enter image description here

关于php - 共享主机上的 Composer 内存耗尽,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39301623/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com