36 lines
897 B
Plaintext
Raw Normal View History

#!/bin/sh
2021-07-04 15:45:30 +08:00
# shellcheck disable=SC2068
# shellcheck disable=SC2181
# author: crazywhalecc
# since: 2.5.0
if [ -f "$(pwd)/runtime/php" ]; then
executable="$(pwd)/runtime/php"
2021-07-04 15:45:30 +08:00
echo "* Framework started with built-in php."
else
2021-07-04 15:45:30 +08:00
which php >/dev/null 2>&1
if [ $? -eq 0 ]; then
2021-07-04 15:45:30 +08:00
executable=$(which php)
else
2021-07-04 15:45:30 +08:00
echo '[ErrCode:E00014] Cannot find any PHP runtime, please use command "./install-runtime.sh" or install PHP manually!'
exit 1
fi
fi
2021-07-04 15:45:30 +08:00
result=$(echo "$1" | grep -E "module|build")
if [ "$result" != "" ]; then
executable="$executable -d phar.readonly=off"
fi
if [ -f "$(pwd)/src/entry.php" ]; then
2021-07-04 15:45:30 +08:00
$executable "$(pwd)/src/entry.php" $@
elif [ -f "$(pwd)/vendor/zhamao/framework/src/entry.php" ]; then
2021-07-04 15:45:30 +08:00
$executable "$(pwd)/vendor/zhamao/framework/src/entry.php" $@
else
2021-07-04 15:45:30 +08:00
echo "[ErrCode:E00015] Cannot find zhamao-framework entry file!"
exit 1
fi