Issue
I have hit the error
Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleWatchGraph.php on line 52
Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors
While trying the code:
composer require laravel/passport
in my laravel project.
I have tried following the instructions in the link but I am unable to increase my memory limit because I cannot find the file php.ini in my /etc/ directory. I can only find php.ini.default and I have increased the memory limit there to 900MB. I have restarted apache for the new configuration to reflect but the limit still shows 128MB which is what it has always shown in when I run the command:
php -r "echo ini_get('memory_limit').PHP_EOL;"
How can I get this fixed? My php version is 7.3.9
I must also mention that the issue I have is peculiar to a particular project. I have been able to successfully run
composer require laravel/passport
in another project
Solution
Try renaming the php.ini.default
to php.ini
. PHP doesn't load it if it has the .default
extension. You can run php --ini
in your console to see which ini files are loaded. Your php.ini
should be in this list, otherwise just add the memory limit setting to another file in this list.
There can also be a case where there are two different ini configs, one for cli and one for web. If you have both make sure you're editing the correct one. If you've got php-fpm installed you'll most lkikely have a php.ini
in /etc/php/7.3/fpm
and /etc/php/7.3/cli
.
If all of the above doesn't work you can always try to just reinstall your vendors:
- delete your vendor folder
- delete your composer.lock (composer's cache)
- add the passport requirement manually to your
composer.json
(e.g."laravel/passport": "^7.3"
) - and finally run
composer install
, installing everything again.
Answered By - akalucas Answer Checked By - Mary Flores (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.