composer require报错: Allowed memory size of 1610612736 bytes exhausted

报错信息:

Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes)

方法一

看提示应该是内存超出了,修改php.ini中memory_limit=-1(不限制内存),重启环境

然后查看php限制的内存,是否修改成功
php -r "echo ini_get('memory_limit').PHP_EOL;"

修改成功后再去composer试试

方法二

上面是网上找到的方法,我按照上面的方法操作后,依旧报错;可能我的这种情况不适合上面的解决办法.

接着寻求解决办法,最终我把要安装的包直接写入composer.json中,然后composer update后成功,好吧,就是这么简单

"require": {
    "php": "^7.2",
    "ext-json": "*",
    "fideloper/proxy": "^4.0",
    "fruitcake/laravel-cors": "^1.0",
    "laravel/framework": "^6.2",
    "laravel/helpers": "^1.1",
    "laravel/horizon": "^3.6",
    "laravel/scout": "^8.0",
    "laravel/telescope": "^2.1",
    "laravel/tinker": "^2.0",
    "mews/purifier": "^3.1",
    "simplesoftwareio/simple-qrcode": "^3.0"
},
上一篇:MySQL索引创建与删除


下一篇:IntelliJ IDEA里面的Project和Module