Marlonreds12's avatar

Error upon PHP ARTISAN SERVE

Hi, i got this error everytime i would php artisan serve then it crashes can someone help me

ErrorException

Undefined array key 1

at vendor\laravel\framework\src\Illuminate\Foundation\Console\ServeCommand.php:312 308▕ $line = str_replace(' ', ' ', $line); 309▕ 310▕ preg_match($regex, $line, $matches); 311▕ ➜ 312▕ return Carbon::createFromFormat('D M d H:i:s Y', $matches[1]); 313▕ } 314▕ 315▕ /** 316▕ * Get the request port from the given PHP server output.

1 vendor\laravel\framework\src\Illuminate\Foundation\Console\ServeCommand.php:312 Illuminate\Foundation\Bootstrap\HandleExceptions::Illuminate\Foundation\Bootstrap{closure}("Undefined array key 1", "C:\xampp\htdocs\thesis-laravel\vendor\laravel\framework\src\Illuminate\Foundation\Console\ServeCommand.php")

2 vendor\laravel\framework\src\Illuminate\Foundation\Console\ServeCommand.php:277 Illuminate\Foundation\Console\ServeCommand::getDateFromLine("023] 127.0.0.1:65250 Closing")

0 likes
5 replies
tisuchi's avatar

@marlonreds12

  • Make sure that you have the right php version!

  • If the previous point is not working, then try this:

php artisan config:clear
php artisan cache:clear
php artisan view:clear

And then run.

  • Still if it's not working, then remove /vendor folder and install it again.
1 like
Cruorzy's avatar

I see people fixing this with composer update Maybe check if your PHP version is right for the Laravel version you are using.

1 like

Please or to participate in this conversation.