I am using WSL (windows subsystem linux) to locally develop PHP files.
I am using the inbuilt PHP server to run them via Ubuntu:
php -S localhost:8000
I've made a Bashrc function to do this for me but it pauses after creating the localhost.
phpLocal(){
php -S localhost:"$1"
cmd.exe /C start http://localhost:"$1"
}
The goal is to run
phpLocal 8200
and this to open a web browser with the local host running localhost:8200.
The issue
Bash accepts the command - i.e. creates the localhost server on port 8200, but the browsers does not open it.
Then when I cancel the command the browser does open it, but because the command has been canceled there is nothing to open..
I suspect I am missing some in how bash runs functions.
Any help would be great - Wally
-- Requested information
I am calling this function like this
phpLocal 8200
-- renamed question as I believe it not to be a duplicate, but the answer to the issue to be the same. I think its valuable for people searching broader terms relating to bash functions...

