Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Add one line install script and instructions to README #594

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
61 changes: 61 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/sh

withinboredom marked this conversation as resolved.
Show resolved Hide resolved
set -e

if [ -z "$BIN_DIR" ]; then
BIN_DIR=$(pwd)
fi

THE_ARCH_BIN=""
THIS_PROJECT_OWNER="dunglas"
DEST=$BIN_DIR/frankenphp
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not install directly the binary in /usr/local/bin/? This will simplify the one-liner provided in docs.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that change makes an assumption that there is a /usr/local/bin to install to or that the user has permissions to do so. I, personally, would be wary of running a random curl'd script with root permissions just to install something.

I think you can probably make the docs more readable by suggesting BIN_DIR:

curl -sLK https://raw.githubusercontent.com/dunglas/frankenphp/main/install.sh | BIN_DIR=/usr/local/bin sh

and modify the script prompt for sudo if it fails to copy.


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"
dunglas marked this conversation as resolved.
Show resolved Hide resolved

chmod +x "$DEST"

echo "Installed successfully to: $DEST"