-
Notifications
You must be signed in to change notification settings - Fork 11.4k
[8.x] Local dev server spawns a new server on port number + 1
when environment reloaded
#34121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I can't reproduce this. Works fine for me:
|
I've the same problem
|
Hi @driesvints. Is there anything else I can do, or any information I can provide that would assist? I've just tried this again, with an even simpler setup (no
Unsure if it matters, but I'm running Ubuntu 18.04.5, Composer 1.10.10, and of course version 4.0.0 of the Laravel installer. Let me know if I can provide any further information. |
Is everyone who's experiencing this using Ubuntu? I can't reproduce this on macOS. |
Xubuntu in my case.
|
The processes don't 'zombie' for me: if I run Also, if I serve the local dev site and force the config to reload 10 times, it spawns sites on ports 8000 to 8010, then cannot create any more (as I think the upper port limit is 8010) then the |
@vaughany That's what I meant by "zombie" - they're just left hanging around, even though they should have terminated. They do work, they're just not supposed to exist anymore. |
@AegirLeet Apologies, took you too literally. :) |
@driesvints Some troubleshooting with different Ubuntus: I used Vagrant to spin up Ubuntu 16.04.5 LTS with PHP 7.4.9, and got the same issue. I used Vagrant to spin up Ubuntu 20.04 LTS with PHP 7.4, and got the same issue. I used Vagrant to spin up Debian 10.5 with PHP 7.3.19, and got the same issue. |
Pull requests welcome. I don't use Ubuntu. |
Troubleshooting steps: running
So the first line is the shell command, and the second is the command the shell command runs. Makes sense so far. If I reload the
So it seems that the original command Edit: stripped the info out, but the command starting |
Prefixing the command at framework/src/Illuminate/Foundation/Console/ServeCommand.php Lines 107 to 120 in 3624a82
exec seems to work.
This would break Windows though (not sure about macOS), so it would have to be done conditionally for Linux only. |
Sure enough, forcing |
Looks like Symfony's process component actually already has a fix for this in place at https://github.com/symfony/symfony/blob/c2522fa325c36baf278b4390a0d7fd0a339ebc1c/src/Symfony/Component/Process/Process.php#L298-L301, but this isn't used because the commandline isn't supplied as an array (?). Letting the process component handle it through that mechanism would probably be better. |
Using |
mine was just another terminal working on 8000 (which was not closed properly and was still running ), so when i killed it, the serve command got back on 8000 |
This happend to me right now on lates Laravel and PHP installed from brave on mac.
And when i stop server using ctrl+c all process are stoped and when i start server again is on 8000 again... |
Same here on macos sequoia 15.2 with php 8.4 on fresh laravel 11 project
|
Encountering a very similar issue, but with static port, not with sequential ports:
I run multiple Laravel projects, multiple versions, different host/port locally, like so:
I've got iTerm2 Profiles set up to run these, and they all work initially and expose Laravel 10 Projects:
As you can see, no issues for projects A (and B and C, again all Laravel 10, being served on different hosts/ports using Laravel 11 Project:
Running I can live with a simple |
Description:
Development server (run with
./artisan serve
) cannot listen on same port after .env file reloaded, and starts another server on one port higher. The existing dev server is not shut down when the .env file is edited and saved, so the port's already in use.Steps To Reproduce:
laravel new foo --jet --dev
..env
, then run migrations with./artisan migrate:fresh
../artisan serve
- a local dev server is successfully started on port 8000The text was updated successfully, but these errors were encountered: