Skip to content

Instantly share code, notes, and snippets.

@Gisleburt
Created September 16, 2014 23:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gisleburt/658157f7d752c35ea4df to your computer and use it in GitHub Desktop.
Save Gisleburt/658157f7d752c35ea4df to your computer and use it in GitHub Desktop.
Start / Stop the PHP server (using router.php) in the background
#!/bin/bash
if [ -e "server.pid" ]
then
echo Stopping server
kill `cat server.pid`
rm server.pid
cat error.log
else
echo Starting server
php -S localhost:8000 router.php >> server.log 2> error.log &
echo $! > server.pid
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment