PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Solver.php on line 223

编程语言 / 1430人浏览 / 0人评论

在安装Laravel/ui 3.0 包时候报异常 Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar memory-limit-errors for more info on how to handle out of memory errors.

异常出现背景:

在安装Laravel/ui 3.0 包时候报异常

msi@pozee MINGW64 /d/phpstudy/WWW/laravel-demo (master)

$ composer require laravel/ui:"^3.0"

抛出异常错误:

Warning from https://mirrors.aliyun.com/composer: You are using an outdated version of Composer. Composer 2 is now available and you should upgrade. See https://getcomposer.org/2
./composer.json has been updated
Loading composer repositories with package information
Warning from https://mirrors.aliyun.com/composer: You are using an outdated version of Composer. Composer 2 is now available and you should upgrade. See https://getcomposer.org/2
Updating dependencies (including require-dev)
Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar://C:/composer/composer.phar/src/Composer/DependencyResolver/Solver.php on line 223
Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.

解决方案:

去php的配置文件php.ini中找到memory_limit配置,把配置改为memory_limit=-1,重启php服务器

请查阅memory_limit使用说明:

https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors

memory_limit参数设置允许脚本分配的最大内存量(以字节为单位)

这有助于防止编写不良的脚本占用服务器上的所有可用内存

请注意,没有内存限制,请将此伪指令设置为-1。

推荐学习站点:

https://getcomposer.org/

转载注明:

0 条评论

还没有人发表评论

发表评论 取消回复

记住我的信息,方便下次评论
有人回复时邮件通知我