I am installing passport in laravel by composer using command
$ composer require laravel/passport
Using version ^6.0 for laravel/passport
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
mmap() failed: [12] Cannot allocate memory
mmap() failed: [12] Cannot allocate memory
Fatal error: Out of memory (allocated 483401728) (tried to allocate 8388608 bytes) in phar:///opt/cpanel/composer/bin/composer/src/Composer/DependencyResolver/Solver.php on line 220
I got above errors please help me if you have any solutions.
4
Answers
Source
Memory limit errors.
Composer may sometimes fail on some commands with this message:
In this case, the PHP memory_limit should be increased.
To get the current memory_limit value, run:
Try increasing the limit in your
php.ini
file (ex./etc/php5/cli/php.ini
for Debian-like systems):Composer also respects a memory limit defined by the
COMPOSER_MEMORY_LIMIT
environment variable:Or, you can increase the limit with a command-line argument:
This issue can also happen on cPanel instances, when the shell fork bomb protection is activated. For more information, see the documentation of the fork bomb feature on the cPanel site.
This answer might also be useful.
Try the following steps:
In the root of your project in the composer.json in the line of require “require”: {
"laravel/ui": "^1.1"
} and next, composer updateI was able to install Passport by temporarily removing PHP’s memory limit. I found this idea here: https://laravel.io/forum/02-11-2014-composer-running-out-of-memory
I like this solution because it overrides the PHP limit only once, so it allows you to push forward without any lasting affects. This will allow you to wait and see if you continue to get issues later, such as in the production environment, etc.
The default PHP installation allocates 500 MB~ RAM I believe, and when I ran that above command, it consumed 712 MB of RAM.