Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ior's avatar
Level 1

Laravel php artisan serve on Microsoft Server stops unexpectedly

When running php artisan serve, my Laravel artisan serve initially starts without issues. However, after a few minutes, I start receiving warnings such as "Invalid request (Malformed HTTP request)" and "Invalid request (Unsupported SSL request)" for incoming requests from specific IPs. Shortly after, the server crashes with errors pointing to undefined array keys in Laravel's ServeCommand.php.

2024-07-21 11:28:17 ........................................................................................... ~ 0s WARN Invalid request (An existing connection was forcibly closed by the remote host).

2024-07-21 12:44:49 ........................................................................................... ~ 3s 2024-07-21 12:44:52 ........................................................................................... ~ 4s 2024-07-21 12:44:59 ........................................................................................... ~ 0s 2024-07-21 12:44:59 /favicon.ico .............................................................................. ~ 0s WARN Invalid request (Malformed HTTP request).

2024-07-21 12:44:59 ........................................................................................... ~ 0s 2024-07-21 12:47:43 ........................................................................................... ~ 0s WARN Invalid request (An existing connection was forcibly closed by the remote host).

2024-07-21 12:56:12 ........................................................................................... ~ 4s 2024-07-21 12:56:16 ........................................................................................... ~ 3s 2024-07-21 12:56:24 ........................................................................................... ~ 0s 2024-07-21 12:56:25 /favicon.ico .............................................................................. ~ 1s WARN Invalid request (Malformed HTTP request).

2024-07-21 12:56:26 ........................................................................................... ~ 0s 2024-07-21 13:20:18 ........................................................................................... ~ 0s 2024-07-21 13:20:18 ........................................................................................... ~ 1s 2024-07-21 13:20:19 ........................................................................................... ~ 0s 2024-07-21 13:20:19 ........................................................................................... ~ 1s WARN Invalid request (Malformed HTTP request).

2024-07-21 13:49:34 ........................................................................................... ~ 0s 2024-07-21 14:37:09 ........................................................................................... ~ 0s WARN Invalid request (Unsupported SSL request).

The errors specifically mention Undefined array key 1 and Undefined array key 55230 at certain lines in ServeCommand.php, related to handling requests. Could someone explain what causes these warnings and errors? How can I address these issues to stabilize my development environment?. Thank you.

ErrorException

Undefined array key 49768

at \vendor\laravel\framework\src\Illuminate\Foundation\Console\ServeCommand.php:265 261▕ 262▕ $this->requestsPool[$requestPort][1] = trim(explode('[200]: GET', $line)[1]); 263▕ } elseif (str($line)->contains(' Closing')) { 264▕ $requestPort = $this->getRequestPortFromLine($line); ➜ 265▕ $request = $this->requestsPool[$requestPort]; 266▕ 267▕ [$startDate, $file] = $request; 268▕ 269▕ $formattedStartedAt = $startDate->format('Y-m-d H:i:s');

0 likes
5 replies
dpelto's avatar

Could you try Apache or Nginx?

1 like
jlrdw's avatar

In the question you have:

When running php artisan serve,.....

That isn't apache.

ior's avatar
Level 1

@jlrdw it says in my Laragon "Apache httpd-2.4.54-win64-VS16 started" and if im wrong where can i see what im currently using?

Please or to participate in this conversation.