如何解决Laravel项目中的内存限制和作曲家错误? [英] How to solve memory limit and composer errors in Laravel project?
问题描述
当我通过 php artisan服务运行Laravel项目时,我收到关于/vendor/autoload.php 的错误,因为/artisan中没有此类文件或目录.然后,在进行了几次研究之后,我发现作曲家不存在.因此,我尝试通过 composer update 来更新composer,但出现如下有关内存限制的错误:
When I run the Laravel project via php artisan serve I get an error about /vendor/autoload.php as no such file or directiory in /artisan. Then after I did couple of research I found that composer does not exist. Hence, I tried to update composer via composer update I get an error about the memory limit as such:
致命错误:在phar:///usr/local/Cellar/composer/1.10.7/bin/composer/src/Composer/DependencyResolver/Solver中,耗尽了1610612736字节的允许内存大小(尝试分配67108864字节).223行上的php
Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 67108864 bytes) in phar:///usr/local/Cellar/composer/1.10.7/bin/composer/src/Composer/DependencyResolver/Solver.php on line 223
然后我尝试使用命令 php -d memory_limit = -1 来增加内存以使内存无限,但是,终端没有给我响应.我通过 git 克隆了该项目,并且我的项目中没有 .env 文件.我该如何解决这个问题?
And then I try to increase the memory to make the memory infinite with the command php -d memory_limit=-1 but then, terminal is not giving me a response. I cloned the project through git and there is no .env file in my project. How can I solve the problem?
运行 composer install 时,出现以下错误.
When I run composer install I get the errors below.
问题1-laravel/horizon v4.3.3的安装请求->laravel/horizon [v4.3.3]可以满足.-laravel/horizon v4.3.3需要ext-pcntl *->您的系统缺少所需的PHP扩展名pcntl.
Problem 1 - Installation request for laravel/horizon v4.3.3 -> satisfiable by laravel/horizon[v4.3.3]. - laravel/horizon v4.3.3 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system.
问题2-phpoffice/phpspreadsheet 1.13.0的安装请求->phpoffice/phpspreadsheet [1.13.0]可以满足要求.-phpoffice/phpspreadsheet 1.13.0需要ext-zip *->您的系统缺少所需的PHP扩展zip.
Problem 2 - Installation request for phpoffice/phpspreadsheet 1.13.0 -> satisfiable by phpoffice/phpspreadsheet[1.13.0]. - phpoffice/phpspreadsheet 1.13.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
问题3-phpoffice/phpspreadsheet 1.13.0需要ext-zip *->您的系统缺少所需的PHP扩展zip.-maatwebsite/excel 3.1.19需要phpoffice/phpspreadsheet ^ 1.10->phpoffice/phpspreadsheet [1.13.0]可以满足要求.-maatwebsite/excel 3.1.19的安装请求->maatwebsite/excel [3.1.19]可以满足要求.
Problem 3 - phpoffice/phpspreadsheet 1.13.0 requires ext-zip * -> the requested PHP extension zip is missing from your system. - maatwebsite/excel 3.1.19 requires phpoffice/phpspreadsheet ^1.10 -> satisfiable by phpoffice/phpspreadsheet[1.13.0]. - Installation request for maatwebsite/excel 3.1.19 -> satisfiable by maatwebsite/excel[3.1.19].
推荐答案
您尝试使用此处
您也可以尝试使用以下命令 php -d memory_limit = -1 $(哪个作曲家更新)
You can also try this command php -d memory_limit=-1 $(which composer) update
您可能也想选中该主题
也
我必须在命令行中组合
COMPOSER_MEMORY_LIMIT
和memory_limit
:
在Windows上:
set COMPOSER_MEMORY_LIMIT=99999999999&& php -d memory_limit=-1 composer.phar update
在Linux上:
export COMPOSER_MEMORY_LIMIT=99999999999 && php -d memory_limit=-1 composer.phar update
这篇关于如何解决Laravel项目中的内存限制和作曲家错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!