Skip to content

Instantly share code, notes, and snippets.

@AdrianSchneider
Last active December 31, 2015 21:29
Show Gist options
  • Save AdrianSchneider/8047087 to your computer and use it in GitHub Desktop.
Save AdrianSchneider/8047087 to your computer and use it in GitHub Desktop.
PHP built-in server on next unused port seq 8000 65000 defines the port range
#!/bin/sh
for port in $(seq 8000 65000); do echo -ne "\035" | telnet 127.0.0.1 $port > /dev/null 2>&1; [ $? -eq 1 ] && echo "$port" && break; done
php -S localhost:`bin/next-port` & # Listening on http://localhost:8000
php -S localhost:`bin/next-port` & # Listening on http://localhost:8001
php -S localhost:`bin/next-port` & # Listening on http://localhost:8002
php -S localhost:`bin/next-port` & # Listening on http://localhost:8003
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment