2021-05-08 10:02:41 +08:00
|
|
|
#!/bin/sh
|
2020-03-02 16:14:20 +08:00
|
|
|
|
2021-06-16 00:17:30 +08:00
|
|
|
# shellcheck disable=SC2068
|
|
|
|
|
# shellcheck disable=SC2181
|
|
|
|
|
# author: crazywhalecc
|
|
|
|
|
# since: 2.5.0
|
|
|
|
|
|
2022-05-14 23:52:37 +08:00
|
|
|
if [ "$ZM_CUSTOM_PHP_PATH" != "" ]; then
|
|
|
|
|
echo "* Using PHP executable: ""$ZM_CUSTOM_PHP_PATH"
|
|
|
|
|
executable="$ZM_CUSTOM_PHP_PATH"
|
|
|
|
|
elif [ -f "$(pwd)/runtime/php" ]; then
|
2021-05-08 10:02:41 +08:00
|
|
|
executable="$(pwd)/runtime/php"
|
|
|
|
|
echo "* Framework started with built-in php."
|
|
|
|
|
else
|
2021-06-16 00:17:30 +08:00
|
|
|
which php >/dev/null 2>&1
|
2021-05-08 10:02:41 +08:00
|
|
|
if [ $? -eq 0 ]; then
|
2021-06-16 00:17:30 +08:00
|
|
|
executable=$(which php)
|
2021-05-08 10:02:41 +08:00
|
|
|
else
|
2021-06-16 00:17:30 +08:00
|
|
|
echo '[ErrCode:E00014] Cannot find any PHP runtime, please use command "./install-runtime.sh" or install PHP manually!'
|
|
|
|
|
exit 1
|
2021-05-08 10:02:41 +08:00
|
|
|
fi
|
|
|
|
|
fi
|
2021-01-18 18:08:29 +08:00
|
|
|
|
2021-05-08 10:02:41 +08:00
|
|
|
if [ -f "$(pwd)/src/entry.php" ]; then
|
2021-06-16 00:17:30 +08:00
|
|
|
$executable "$(pwd)/src/entry.php" $@
|
2021-05-08 10:02:41 +08:00
|
|
|
elif [ -f "$(pwd)/vendor/zhamao/framework/src/entry.php" ]; then
|
2021-06-16 00:17:30 +08:00
|
|
|
$executable "$(pwd)/vendor/zhamao/framework/src/entry.php" $@
|
2021-05-08 10:02:41 +08:00
|
|
|
else
|
2021-06-16 00:17:30 +08:00
|
|
|
echo "[ErrCode:E00015] Cannot find zhamao-framework entry file!"
|
|
|
|
|
exit 1
|
2021-05-08 10:02:41 +08:00
|
|
|
fi
|