Skip to content

Instantly share code, notes, and snippets.

@infurno
Created September 27, 2013 20:06
Show Gist options
  • Select an option

  • Save infurno/6734420 to your computer and use it in GitHub Desktop.

Select an option

Save infurno/6734420 to your computer and use it in GitHub Desktop.
Quick start PHP server in current directory or custom directory.
#!/bin/bash
# Description: Quick start PHP server in current directory or custom directory.
# By: Hal Borland of Southern Fried Pixels
# Usage: serve "port" "htdoc"
# Example: serve 8000 ./public
if [[ "$1" != "" ]]; then
PORT=$1
else
PORT="8888"
fi
if [[ "$2" != "" ]]; then
htdocs=$2
else
htdocs=$PWD
fi
php -S 0.0.0.0:${PORT} -t ${htdocs}
@infurno
Copy link
Author

infurno commented Sep 27, 2013

Install this script in ~/bin or in user PATH.

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