Skip to content

Instantly share code, notes, and snippets.

@ebylund
Created March 21, 2016 20:20
Show Gist options
  • Save ebylund/b3d6fef634657fb00484 to your computer and use it in GitHub Desktop.
Save ebylund/b3d6fef634657fb00484 to your computer and use it in GitHub Desktop.
simple php server helper to develop locally
#!/bin/bash
passed="false"
while [ $passed != "true" ]
do
read -p "What port do you want your server on?: " port;
if [ $port -gt "65535" ]
then
echo -e "\033[31mport:$port\033[0m too high, Please choose a port number less than 65535"
elif [ $port -lt "1024" ]
then
echo -e "\033[31mport:$port\033[0m too low, Please choose a port number greater than 1024"
else
echo -e "Starting server on port:\033[92m$port\033[0m"
passed="true"
fi
done
open -a "Google Chrome" http://localhost:$port
php -S localhost:$port
#x=~/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure.plist; \
#plutil -convert xml1 $x; \
#grep 'https' -b3 $x | awk 'NR==2 {split($2, arr, "[><]"); print arr[3]}'; \
#plutil -convert binary1 $x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment