Skip to content

Instantly share code, notes, and snippets.

@sincarne
Created June 15, 2018 13:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sincarne/5778cd2be2fb47ddc34e3b7aef8da5c9 to your computer and use it in GitHub Desktop.
Save sincarne/5778cd2be2fb47ddc34e3b7aef8da5c9 to your computer and use it in GitHub Desktop.
Shell function to start a server
# Add this to your .profile
# Typing `serve` with no arguments will start the PHP inbuilt
# server, listening on port 8000.
# If you provide an argument, that is assumed to be the port
# on which to listen.
function serve() {
if [ $# -eq 0 ]; then
php -S localhost:8000
else
php -S localhost:"$@"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment