From 851df5f2169e131dc6f4796c6c802bf19643a447 Mon Sep 17 00:00:00 2001 From: Pulkit Kathuria Date: Tue, 27 Feb 2024 19:14:08 +0900 Subject: [PATCH 1/8] (feat) adds install.sh CI that auto downloads bin from github releases to current directory --- README.md | 11 ++++++++-- install.sh | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 install.sh diff --git a/README.md b/README.md index 8fbef0ef3..58ab0f3ed 100644 --- a/README.md +++ b/README.md @@ -33,8 +33,15 @@ Go to `https://localhost`, and enjoy! ### Standalone Binary -If you prefer not to use Docker, we provide standalone FrankenPHP binaries for Linux and macOS -containing [PHP 8.3](https://www.php.net/releases/8.3/en.php) and most popular PHP extensions: [Download FrankenPHP](https://github.com/dunglas/frankenphp/releases) +If you prefer not to use Docker, we provide standalone FrankenPHP binaries for `Linux` or Mac - Intel, or Apple Chip M1+. +containing [PHP 8.3](https://www.php.net/releases/8.3/en.php) and most popular PHP extensions: + +```sh +curl -sLK https://raw.githubusercontent.com/dunglas/frankenphp/main/install.sh | sh +mv frankenphp /usr/local/bin/ +``` + +Or [Download FrankenPHP manually](https://github.com/dunglas/frankenphp/releases) To serve the content of the current directory, run: diff --git a/install.sh b/install.sh new file mode 100644 index 000000000..5507787dc --- /dev/null +++ b/install.sh @@ -0,0 +1,61 @@ +#!/bin/sh + +set -e + +if [ -z "$BIN_DIR" ]; then + BIN_DIR=$(pwd) +fi + +THE_ARCH_BIN="" +THIS_PROJECT_OWNER="dunglas" +DEST=$BIN_DIR/frankenphp + +THISOS=$(uname -s) +ARCH=$(uname -m) + +case $THISOS in + Linux*) + case $ARCH in + arm64) + THE_ARCH_BIN="" + ;; + aarch64) + THE_ARCH_BIN="$THIS_PROJECT_NAME-linux-aarch64" + ;; + armv6l) + THE_ARCH_BIN="" + ;; + armv7l) + THE_ARCH_BIN="" + ;; + *) + THE_ARCH_BIN="$THIS_PROJECT_NAME-linux-x86_64" + ;; + esac + ;; + Darwin*) + case $ARCH in + arm64) + THE_ARCH_BIN="$THIS_PROJECT_NAME-mac-arm64" + ;; + *) + THE_ARCH_BIN="$THIS_PROJECT_NAME-mac-x86_64" + ;; + esac + ;; + Windows|MINGW64_NT*) + THE_ARCH_BIN="" + ;; +esac + +if [ -z "$THE_ARCH_BIN" ]; then + echo "This script is not supported on $THISOS and $ARCH" + exit 1 +fi + +curl -kL --progress-bar https://github.com/$THIS_PROJECT_OWNER/$THIS_PROJECT_NAME/releases/latest/download/$THE_ARCH_BIN -o "$DEST" + +chmod +x "$DEST" + +echo "Installed successfully to: $DEST" + From 6d76629ea09fd23e614eea1ff9e4f8ae876f161b Mon Sep 17 00:00:00 2001 From: Pulkit Kathuria Date: Tue, 27 Feb 2024 19:20:59 +0900 Subject: [PATCH 2/8] false positive --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 5507787dc..04dc49689 100644 --- a/install.sh +++ b/install.sh @@ -53,7 +53,7 @@ if [ -z "$THE_ARCH_BIN" ]; then exit 1 fi -curl -kL --progress-bar https://github.com/$THIS_PROJECT_OWNER/$THIS_PROJECT_NAME/releases/latest/download/$THE_ARCH_BIN -o "$DEST" +curl -kL --progress-bar "https://github.com/$THIS_PROJECT_OWNER/$THIS_PROJECT_NAME/releases/latest/download/$THE_ARCH_BIN" -o "$DEST" chmod +x "$DEST" From d19cd08e01ee284210484c96d0252798dadfaca0 Mon Sep 17 00:00:00 2001 From: Pulkit Kathuria Date: Wed, 28 Feb 2024 09:59:33 +0900 Subject: [PATCH 3/8] -k gone --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 04dc49689..4a9b34c35 100644 --- a/install.sh +++ b/install.sh @@ -53,7 +53,7 @@ if [ -z "$THE_ARCH_BIN" ]; then exit 1 fi -curl -kL --progress-bar "https://github.com/$THIS_PROJECT_OWNER/$THIS_PROJECT_NAME/releases/latest/download/$THE_ARCH_BIN" -o "$DEST" +curl -L --progress-bar "https://github.com/$THIS_PROJECT_OWNER/$THIS_PROJECT_NAME/releases/latest/download/$THE_ARCH_BIN" -o "$DEST" chmod +x "$DEST" From 8f8935da5def78af22d3dafae45d10e32bc2c74f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Tue, 23 Apr 2024 00:05:08 +0200 Subject: [PATCH 4/8] Update README.md --- README.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 58ab0f3ed..15106358b 100644 --- a/README.md +++ b/README.md @@ -33,26 +33,27 @@ Go to `https://localhost`, and enjoy! ### Standalone Binary -If you prefer not to use Docker, we provide standalone FrankenPHP binaries for `Linux` or Mac - Intel, or Apple Chip M1+. -containing [PHP 8.3](https://www.php.net/releases/8.3/en.php) and most popular PHP extensions: +If you prefer not to use Docker, we provide standalone FrankenPHP binaries for `Linux` and macOS +containing [PHP 8.3](https://www.php.net/releases/8.3/en.php) and most popular PHP extensions. -```sh +[Download FrankenPHP](https://github.com/dunglas/frankenphp/releases) or copy this line into your +terminal to automatically install the version appropriate for your platform: + +```console curl -sLK https://raw.githubusercontent.com/dunglas/frankenphp/main/install.sh | sh mv frankenphp /usr/local/bin/ ``` -Or [Download FrankenPHP manually](https://github.com/dunglas/frankenphp/releases) - To serve the content of the current directory, run: ```console -./frankenphp php-server +frankenphp php-server ``` You can also run command-line scripts with: ```console -./frankenphp php-cli /path/to/your/script.php +frankenphp php-cli /path/to/your/script.php ``` ## Docs From e1d1904337d5eafdc7b95e81f4bbafc6c807bbf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Tue, 23 Apr 2024 00:05:46 +0200 Subject: [PATCH 5/8] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 15106358b..b99eaff18 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Go to `https://localhost`, and enjoy! ### Standalone Binary -If you prefer not to use Docker, we provide standalone FrankenPHP binaries for `Linux` and macOS +If you prefer not to use Docker, we provide standalone FrankenPHP binaries for Linux and macOS containing [PHP 8.3](https://www.php.net/releases/8.3/en.php) and most popular PHP extensions. [Download FrankenPHP](https://github.com/dunglas/frankenphp/releases) or copy this line into your From 14743482d17bfa2ba220ab0dcc861884c7819828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Tue, 23 Apr 2024 00:09:23 +0200 Subject: [PATCH 6/8] Update install.sh --- install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 4a9b34c35..07ae3ce85 100644 --- a/install.sh +++ b/install.sh @@ -10,10 +10,10 @@ THE_ARCH_BIN="" THIS_PROJECT_OWNER="dunglas" DEST=$BIN_DIR/frankenphp -THISOS=$(uname -s) +OS=$(uname -s) ARCH=$(uname -m) -case $THISOS in +case $OS in Linux*) case $ARCH in arm64) @@ -49,7 +49,7 @@ case $THISOS in esac if [ -z "$THE_ARCH_BIN" ]; then - echo "This script is not supported on $THISOS and $ARCH" + echo "This script is not supported on $OS and $ARCH" exit 1 fi From d0a172ccf6b3d2b79b4f1780ab26dc90b3fb6570 Mon Sep 17 00:00:00 2001 From: Pulkit Kathuria Date: Tue, 11 Jun 2024 20:04:55 +0900 Subject: [PATCH 7/8] Update install.sh Co-authored-by: Rob Landers --- install.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 07ae3ce85..8a8b8feb0 100644 --- a/install.sh +++ b/install.sh @@ -53,9 +53,22 @@ if [ -z "$THE_ARCH_BIN" ]; then exit 1 fi -curl -L --progress-bar "https://github.com/$THIS_PROJECT_OWNER/$THIS_PROJECT_NAME/releases/latest/download/$THE_ARCH_BIN" -o "$DEST" -chmod +x "$DEST" +SUDO="" + +# check if $DEST is writable and suppress an error message +touch $DEST 2>/dev/null + +# we need sudo powers to write to DEST +if [ $? -eq 1 ]; then + echo "You do not have permission to write to $DEST, enter your password to grant sudo powers" + SUDO="sudo" +fi + +$SUDO curl -L --progress-bar "https://github.com/$THIS_PROJECT_OWNER/$THIS_PROJECT_NAME/releases/latest/download/$THE_ARCH_BIN" -o "$DEST" + +$SUDO chmod +x "$DEST" + echo "Installed successfully to: $DEST" From 88782a742b6c423cc569b70c114d9b074f68f6e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Tue, 8 Oct 2024 21:21:59 +0200 Subject: [PATCH 8/8] cleanup --- README.md | 2 ++ install.sh | 51 ++++++++++++++++++++++++--------------------------- 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index b99eaff18..be12c5556 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,8 @@ Go to `https://localhost`, and enjoy! If you prefer not to use Docker, we provide standalone FrankenPHP binaries for Linux and macOS containing [PHP 8.3](https://www.php.net/releases/8.3/en.php) and most popular PHP extensions. +On Windows, use [WSL](https://learn.microsoft.com/windows/wsl/) to run FrankenPHP. + [Download FrankenPHP](https://github.com/dunglas/frankenphp/releases) or copy this line into your terminal to automatically install the version appropriate for your platform: diff --git a/install.sh b/install.sh index 8a8b8feb0..66dc468a1 100644 --- a/install.sh +++ b/install.sh @@ -2,54 +2,51 @@ set -e -if [ -z "$BIN_DIR" ]; then +if [ -z "${BIN_DIR}" ]; then BIN_DIR=$(pwd) fi THE_ARCH_BIN="" -THIS_PROJECT_OWNER="dunglas" -DEST=$BIN_DIR/frankenphp +DEST=${BIN_DIR}/frankenphp OS=$(uname -s) ARCH=$(uname -m) -case $OS in +case ${OS} in Linux*) - case $ARCH in - arm64) - THE_ARCH_BIN="" + case ${ARCH} in + aarch64) + THE_ARCH_BIN="frankenphp-linux-aarch64" ;; - aarch64) - THE_ARCH_BIN="$THIS_PROJECT_NAME-linux-aarch64" - ;; - armv6l) - THE_ARCH_BIN="" - ;; - armv7l) - THE_ARCH_BIN="" + x86_64) + THE_ARCH_BIN="frankenphp-linux-x86_64" ;; *) - THE_ARCH_BIN="$THIS_PROJECT_NAME-linux-x86_64" + THE_ARCH_BIN="" ;; esac ;; Darwin*) - case $ARCH in + case ${ARCH} in arm64) - THE_ARCH_BIN="$THIS_PROJECT_NAME-mac-arm64" + THE_ARCH_BIN="frankenphp-mac-arm64" ;; *) - THE_ARCH_BIN="$THIS_PROJECT_NAME-mac-x86_64" + THE_ARCH_BIN="frankenphp-mac-x86_64" ;; esac ;; Windows|MINGW64_NT*) + echo "Install and use WSL to use FrankenPHP on Windows: https://learn.microsoft.com/windows/wsl/" + exit 1 + ;; + *) THE_ARCH_BIN="" ;; esac -if [ -z "$THE_ARCH_BIN" ]; then - echo "This script is not supported on $OS and $ARCH" +if [ -z "${THE_ARCH_BIN}" ]; then + echo "FrankenPHP is not supported on ${OS} and ${ARCH}" exit 1 fi @@ -57,18 +54,18 @@ fi SUDO="" # check if $DEST is writable and suppress an error message -touch $DEST 2>/dev/null +touch "${DEST}" 2>/dev/null # we need sudo powers to write to DEST if [ $? -eq 1 ]; then - echo "You do not have permission to write to $DEST, enter your password to grant sudo powers" + echo "You do not have permission to write to ${DEST}, enter your password to grant sudo powers" SUDO="sudo" fi -$SUDO curl -L --progress-bar "https://github.com/$THIS_PROJECT_OWNER/$THIS_PROJECT_NAME/releases/latest/download/$THE_ARCH_BIN" -o "$DEST" - -$SUDO chmod +x "$DEST" +${SUDO} curl -L --progress-bar "https://github.com/dunglas/frankenphp/releases/latest/download/${THE_ARCH_BIN}" -o "${DEST}" +${SUDO} chmod +x "${DEST}" -echo "Installed successfully to: $DEST" +echo "FrankenPHP downloaded successfully to ${DEST}" +echo "Move the binary to /usr/local/bin/ or another directory in your PATH to use it globally: sudo mv ${DEST} /usr/local/bin/"