Framework: Breaking out of serve broken

Created on 24 May 2019  路  5Comments  路  Source: laravel/framework

  • Laravel Version: 5
  • PHP Version: 7
  • Database Driver & Version: N/A

Description:

27417 breaks being able to ctrl+c out of serve... It retries with 10 more ports.

Grahams-MacBook-Pro:Docs graham$ php artisan serve
Laravel development server started: <http://127.0.0.1:8000>
^CPHP 7.1.29 Development Server started at Fri May 24 21:32:48 2019
Listening on http://127.0.0.1:8000
Document root is /data/public
Press Ctrl-C to quit.
Laravel development server started: <http://127.0.0.1:8001>
^CPHP 7.1.29 Development Server started at Fri May 24 21:33:02 2019
Listening on http://127.0.0.1:8001
Document root is /data/public
Press Ctrl-C to quit.
Laravel development server started: <http://127.0.0.1:8002>
^CLaravel development server started: <http://127.0.0.1:8003>
^CPHP 7.1.29 Development Server started at Fri May 24 21:33:02 2019
Listening on http://127.0.0.1:8003
Document root is /data/public
Press Ctrl-C to quit.
Laravel development server started: <http://127.0.0.1:8004>
^CLaravel development server started: <http://127.0.0.1:8005>
^CPHP 7.1.29 Development Server started at Fri May 24 21:33:02 2019
Listening on http://127.0.0.1:8005
Document root is /data/public
Press Ctrl-C to quit.
Laravel development server started: <http://127.0.0.1:8006>
^CLaravel development server started: <http://127.0.0.1:8007>
^CPHP 7.1.29 Development Server started at Fri May 24 21:33:02 2019
Listening on http://127.0.0.1:8007
Document root is /data/public
Press Ctrl-C to quit.
Laravel development server started: <http://127.0.0.1:8008>
^CLaravel development server started: <http://127.0.0.1:8009>
^CPHP 7.1.29 Development Server started at Fri May 24 21:33:02 2019
Listening on http://127.0.0.1:8009
Document root is /data/public
Press Ctrl-C to quit.
Laravel development server started: <http://127.0.0.1:8010>
^CPHP 7.1.29 Development Server started at Fri May 24 21:33:02 2019
Listening on http://127.0.0.1:8010
Document root is /data/public
Press Ctrl-C to quit.
^C^C^C
Grahams-MacBook-Pro:Docs graham$ 
Grahams-MacBook-Pro:Docs graham$ 
bug

Most helpful comment

I actually find the behaviour of binding to a different port if the one you asked for isn't available very odd anyway. In particular, if I am running serve within docker, and forward a port from to host, it would be odd for laravel to maybe want to try a different port.

Should we change the default to zero tries?

All 5 comments

I actually find the behaviour of binding to a different port if the one you asked for isn't available very odd anyway. In particular, if I am running serve within docker, and forward a port from to host, it would be odd for laravel to maybe want to try a different port.

Should we change the default to zero tries?

@GrahamCampbell - it's related to this recent PR for 5.8:

https://github.com/laravel/framework/pull/27417

@GrahamCampbell can you please fill out the issue template?

The related PR says:

The inspiration for this addition comes from vue-cli, if you try to run a project (with npm run serve) it starts on port 8080 and if it in-use it'll go to the next port and try it until it comes up with an open port.

So maybe we should try to find a way to keep the behavior but still allow quitting with CTRL+C

I can't actually seem to replicate this. Regardless, I have fixed the port behavior where if an explicit port is passed it will not try others.

image

Was this page helpful?
0 / 5 - 0 ratings