I have just set up a new Laravel 8 project. When i try and run it i get the following fatal error:
PHP Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 32768 bytes) in /media/cal/500GB/cal/backend/vendor/composer/autoload_static.php on line 2297
PHP memory_limit is set to 2048MB
if I try and run any command related to Laravel or Composer I get a fatal error so this command
laravel --version
gives me this error:
PHP Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 12288 bytes) in /home/cal/.config/composer/vendor/symfony/console/Color.php on line 165
Even just typing composer give me the memory_error.
This command shows I have 2048MB memory_limit
php -r "echo ini_get('memory_limit').PHP_EOL;"
Where does composer get that value of just 2MB from?
How can I fix this please? Any help is greatly appreciated.
CodePudding user response:
If php -r "echo ini_get('memory_limit').PHP_EOL;"
prints a setting of 2048MB
, you mis-configured the memory limit. According to the documentation, it should not contain a B
at the end. Try to set it to 2048M
instead
CodePudding user response:
Are you any function like print_r
or die
? If yes, use dd()
instead.