PHP Fatal error: Allowed memory size of 104857600 bytes exhausted
I am getting this error every time I try running php artisan serve command in my project. I have tried increasing the memory limit in the php.ini file as many have suggested but it is still not working. The error seems to be coming from the guzzle package which makes requests. Before I got this error, I was making api calls to a certain API. I even tried restarting my computer but it didn't work. Please help me. This is the full error:
php artisan serve
PHP Fatal error: Allowed memory size of 104857600 bytes exhausted (tried to allocate 20480 bytes) in C:\Users\user\Desk
top\content_creation\programming_projects\p1\vendor\guzzlehttp\guzzle\src\Client.php on line 256
PHP Fatal error: Allowed memory size of 104857600 bytes exhausted (tried to allocate 32768 bytes) in C:\Users\user\Desk
top\content_creation\programming_projects\p1\vendor\symfony\error-handler\Error\FatalError.php on line 1
@Sinnbeck That is the code I was trying to execute before I got that error for the first time in the terminal. I tried everything to solve it but it din't work. When I restarted my laptop and tried to run the laravel project again using the php artisan serve command, I was shocked that I was still getting the same error. That code is in a service that I call from a command that I created to execute the code every time I run it.
@Sinnbeck If I run php artisan serve in another project, it starts the server. However, if I run it in this particular project I am talking about, I get that error and it doesn't start the server.
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 12288 bytes) in C:\Users\user\Desktop\content_creation\programming_projects\demobet\vendor\guzzlehttp\guzzle\src\Handler\Proxy.php on line 47
PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 8192 bytes) in C:\Users\user\Desktop\content_creation\programming_projects\demobet\vendor\symfony\error-handler\Error\FatalError.php on line 50
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255
@Sinnbeck Hey, I have realized that the problem is in the Commands folder and specifically the commands files I had created. Could you help me realize the error in the files.
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Andonovn\LaravelBetsApi\BetsApi;
use App\Services\FetchOdds;
class FetchEventOdds extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'sb:fetch-event-odds';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Fetches event odds from soccer_events event_id';
private $fetchOdds;
public $betsApiIntance;
public function __construct(BetsApi $betsapi, FetchOdds $fetchOdds)
{
parent::__construct();
$this->fetchOdds = $fetchOdds;
$this->betsApiIntance = $betsapi;
}
public function handle()
{
$this->fetchOdds->fetchOdds($this->betsApiIntance);
$this->info("Sports data updated");
}
}