Skip to content

Instantly share code, notes, and snippets.

@Tom32i
Last active January 29, 2016 10:03
Show Gist options
  • Save Tom32i/7473750238137f4ae642 to your computer and use it in GitHub Desktop.
Save Tom32i/7473750238137f4ae642 to your computer and use it in GitHub Desktop.
Quickly serve a local directory with PHP built-in server.

Quickly serve a local directory

php -S localhost:8000

You directory is accessible on: http://localhost:8000

Create an alias for it

In ~/.bashrc add:

alias serve='open http://localhost:8000; php -S localhost:8000'

Now you can just use the serve alias. It will launch the server and open the url in you default browser.

Note: open is an Mac OS X command, you should be able to find a similar command on other systems though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment