aboutsummaryrefslogtreecommitdiff
path: root/serve.sh
diff options
context:
space:
mode:
authorFranziska Kunsmann2021-04-04 12:43:39 +0200
committerFranziska Kunsmann2021-04-04 12:43:39 +0200
commit57511e237db2ea189be9cd9397d5f5291307f424 (patch)
treed8eafd66a1273f093d1f63f89a2b31cbd5e88dfa /serve.sh
parent5b816a0ac3b863651e23feb085610d63c08466ee (diff)
serve.sh: try php7 first
Diffstat (limited to 'serve.sh')
-rwxr-xr-xserve.sh22
1 files changed, 20 insertions, 2 deletions
diff --git a/serve.sh b/serve.sh
index 60e378b..537c980 100755
--- a/serve.sh
+++ b/serve.sh
@@ -1,4 +1,22 @@
#!/bin/sh
+
+php_bin=""
port=8000
-if [ -n "$1" ]; then port=$1; fi
-php -S localhost:$port -d short_open_tag=true index.php
+
+for try_bin in {php7,php}
+do
+ php_bin=$(command -v $try_bin)
+ if [[ -n "$php_bin" ]]
+ then
+ break
+ fi
+done
+
+echo "Using PHP: $php_bin"
+
+if [ -n "$1" ]
+then
+ port=$1
+fi
+
+$php_bin -S localhost:$port -d short_open_tag=true index.php