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

joshuadabejero's avatar

PHP Artisan Not Stopping

I am using WSL and use this bash aliases to access XAMPP PHP from Windows.

alias composer='cmd.exe /c composer' alias php='cmd.exe /c php'

I ran 'php artisan serve' then when I press CTRL + C, it stops, but when I reload the browser the server is still running.

Does anyone have a solution or any command to stop the server, please help.

Thanks!

0 likes
3 replies
Nash's avatar

Are you using the Linux (WSL) terminal to launch the Windows CMD and execute Windows programs/commands? This seems like a messy setup. I would rather install/run them directly under WSL, simply use Windows, or install Laravel Homestead (a virtual Ubuntu machine with everything you need for Laravel development) and then SSH into that.

You could also try MobaXterm. It gives you the basic UNIX tools and commands but should still be able to execute native Windows programs just like you would in CMD.

diegoaurino's avatar

Hello, @joshuadabejero !

This is happening because when you press CTRL + C on Bash, it sends a SIGINT to the job running in the foreground. In other words, it interrupts the job on Bash but not the CMD.exe command that is running outside the WSL environment with the /C flags that says to the command run and then terminates itself when finished. The command will not terminate because it can't receive the SIGINT from bash.

Besides what @nash suggested, I would recommend you install the full LAMP inside WSL. So, you would have the best of XAMPP, but running natively inside WSL.

If your intention is to continue with your current environment, you can create a .bat script that is called by a specific alias that kills any php.exe instance that is running on Windows. Or more complexly, create a .ps1 scripts that run and watch the command it has called, thus it can kill those command when finished. But I believe the things start to be unnecessarily complex here.

Good luck!

joshuadabejero's avatar

@DIEGOAURINO - Hey! What I did is CTRL + SHIFT + D but it will kill the current terminal too. But yes it's fine still as I am using XAMPP Apache I think I don't need to 'php artisan serve' anymore.

Anyways thanks mate! I kinda love the community. I am new to Laravel and plan to use it now and apply it on my work.

Cheers!

Please or to participate in this conversation.