Created
September 27, 2013 20:06
-
-
Save infurno/6734420 to your computer and use it in GitHub Desktop.
Quick start PHP server in current directory or custom directory.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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} |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Install this script in ~/bin or in user PATH.