Composer require runs out of memory. PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted Voyager
Composer require runs out of memory. PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted Voyager
您好,我正在尝试解决安装 voyager 时遇到的一些问题。
当我尝试 运行 composer require 时,出现内存不足错误。我不明白到底发生了什么。它在我的控制台上的结果:
@DESKTOP->>>>> /c/xampp/htdocs/ (master)
$ composer require tcg/voyager
Using version ^1.4 for tcg/voyager
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 134217736 bytes) in phar://C:/composer/composer.phar/src/Composer/DependencyResolver/RuleSet.php on line 83```
可能 composer.JSON 有问题,我需要检查一下。你应该注意什么问题
我的 composer.json 文件```
{
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.2",
"convertapi/convertapi-php": "^1.1",
"fideloper/proxy": "^4.0",
"laravel/framework": "^6.2",
"laravel/socialite": "^4.3",
"laravel/tinker": "^1.0",
"openpayu/openpayu": "^2.2",
"paypal/rest-api-sdk-php": "^1.14",
"pragmarx/tracker": "^3.5",
"spatie/laravel-backup": "^6.8",
"spatie/pdf-to-image": "^2.0",
"tcg/voyager": "^1.3"
},
"require-dev": {
"facade/ignition": "^1.4",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^3.0",
"phpunit/phpunit": "^8.0",
"tanmuhittin/laravel-google-translate": "^1.0"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\": "app/"
},
"files": [
"app/Helpers/HelperFunctions.php"
],
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\Foundation\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
},
"repositories": {
"hooks": {
"type": "composer",
"url": "https://larapack.io"
}
}
}
看起来您正在使用 xampp。
您可以尝试更改 php.ini
中的 memory_limit
。
找到这个:
;memory_limit=512M
更改为:
memory_limit =-1
然后从 xampp
重新启动 Apache
您还可以使用以下命令将航海者安装到您的服务器中:
COMPOSER_MEMORY_LIMIT=-1 composer require tcg/voyager
而不只是 composer require tcg/voyager
我在这个 thread 上找到了这个。希望能帮助到你。 Andy Song 的解决方案更好。
如果您的作曲家在 /usr/local/bin/ 使用:
php -d memory_limit=-1 /usr/local/bin/composer require tcg/voyager
--
参考作曲家文档https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors
获取当前memory_limit值,运行:
php -r "echo ini_get('memory_limit').PHP_EOL;"
尝试增加 php.ini 文件中的限制(例如 /etc/php5/cli/php.ini 类 Debian 系统):
;使用 -1 表示无限制或定义一个明确的值,如 2G
memory_limit = -1
Composer 还遵守 COMPOSER_MEMORY_LIMIT 环境变量定义的内存限制:
COMPOSER_MEMORY_LIMIT=-1 composer.phar <...>
或者,您可以使用命令行参数增加限制:
php -d memory_limit=-1 composer.phar <...>
您好,我正在尝试解决安装 voyager 时遇到的一些问题。 当我尝试 运行 composer require 时,出现内存不足错误。我不明白到底发生了什么。它在我的控制台上的结果:
@DESKTOP->>>>> /c/xampp/htdocs/ (master) $ composer require tcg/voyager Using version ^1.4 for tcg/voyager ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 134217736 bytes) in phar://C:/composer/composer.phar/src/Composer/DependencyResolver/RuleSet.php on line 83```
可能 composer.JSON 有问题,我需要检查一下。你应该注意什么问题 我的 composer.json 文件``` {
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.2",
"convertapi/convertapi-php": "^1.1",
"fideloper/proxy": "^4.0",
"laravel/framework": "^6.2",
"laravel/socialite": "^4.3",
"laravel/tinker": "^1.0",
"openpayu/openpayu": "^2.2",
"paypal/rest-api-sdk-php": "^1.14",
"pragmarx/tracker": "^3.5",
"spatie/laravel-backup": "^6.8",
"spatie/pdf-to-image": "^2.0",
"tcg/voyager": "^1.3"
},
"require-dev": {
"facade/ignition": "^1.4",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^3.0",
"phpunit/phpunit": "^8.0",
"tanmuhittin/laravel-google-translate": "^1.0"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\": "app/"
},
"files": [
"app/Helpers/HelperFunctions.php"
],
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\Foundation\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
},
"repositories": {
"hooks": {
"type": "composer",
"url": "https://larapack.io"
}
}
}
看起来您正在使用 xampp。
您可以尝试更改 php.ini
中的 memory_limit
。
找到这个:
;memory_limit=512M
更改为:
memory_limit =-1
然后从 xampp
重新启动 Apache您还可以使用以下命令将航海者安装到您的服务器中:
COMPOSER_MEMORY_LIMIT=-1 composer require tcg/voyager
而不只是 composer require tcg/voyager
我在这个 thread 上找到了这个。希望能帮助到你。 Andy Song 的解决方案更好。
如果您的作曲家在 /usr/local/bin/ 使用:
php -d memory_limit=-1 /usr/local/bin/composer require tcg/voyager
--
参考作曲家文档https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors
获取当前memory_limit值,运行:
php -r "echo ini_get('memory_limit').PHP_EOL;"
尝试增加 php.ini 文件中的限制(例如 /etc/php5/cli/php.ini 类 Debian 系统):
;使用 -1 表示无限制或定义一个明确的值,如 2G
memory_limit = -1
Composer 还遵守 COMPOSER_MEMORY_LIMIT 环境变量定义的内存限制:
COMPOSER_MEMORY_LIMIT=-1 composer.phar <...>
或者,您可以使用命令行参数增加限制:
php -d memory_limit=-1 composer.phar <...>