mirror of
https://github.com/dunglas/frankenphp
synced 2024-11-22 16:19:32 +00:00
feat: improve install script (#1097)
Some checks are pending
Lint Code Base / Lint Code Base (push) Waiting to run
Sanitizers / ${{ matrix.sanitizer }} (asan) (push) Waiting to run
Sanitizers / ${{ matrix.sanitizer }} (msan) (push) Waiting to run
Tests / tests (8.2) (push) Waiting to run
Tests / tests (8.3) (push) Waiting to run
Tests / tests (8.4) (push) Waiting to run
Some checks are pending
Lint Code Base / Lint Code Base (push) Waiting to run
Sanitizers / ${{ matrix.sanitizer }} (asan) (push) Waiting to run
Sanitizers / ${{ matrix.sanitizer }} (msan) (push) Waiting to run
Tests / tests (8.2) (push) Waiting to run
Tests / tests (8.3) (push) Waiting to run
Tests / tests (8.4) (push) Waiting to run
This commit is contained in:
parent
ea7a514389
commit
334139ca2b
@ -118,7 +118,7 @@ docker buildx bake -f docker-bake.hcl --pull --no-cache --push
|
||||
```
|
||||
|
||||
2. Replace your current version of `frankenphp` by the debug FrankenPHP executable
|
||||
3. Start FrankenPHP as usual (alternatively, you can directly start FrankenPHP with GDB: `gdb --args ./frankenphp run`)
|
||||
3. Start FrankenPHP as usual (alternatively, you can directly start FrankenPHP with GDB: `gdb --args frankenphp run`)
|
||||
4. Attach to the process with GDB:
|
||||
|
||||
```console
|
||||
@ -172,7 +172,7 @@ docker buildx bake -f docker-bake.hcl --pull --no-cache --push
|
||||
|
||||
```console
|
||||
go test -tags watcher -c -ldflags=-w
|
||||
gdb --args ./frankenphp.test -test.run ^MyTest$
|
||||
gdb --args frankenphp.test -test.run ^MyTest$
|
||||
```
|
||||
|
||||
9. When the bug is fixed, revert all these changes
|
||||
|
@ -42,7 +42,7 @@ On Windows, use [WSL](https://learn.microsoft.com/windows/wsl/) to run FrankenPH
|
||||
terminal to automatically install the version appropriate for your platform:
|
||||
|
||||
```console
|
||||
curl -sLK https://raw.githubusercontent.com/dunglas/frankenphp/main/install.sh | sh
|
||||
curl https://frankenphp.dev/install.sh | sh
|
||||
mv frankenphp /usr/local/bin/
|
||||
```
|
||||
|
||||
|
@ -118,7 +118,7 @@ docker buildx bake -f docker-bake.hcl --pull --no-cache --push
|
||||
```
|
||||
|
||||
2. 将当前版本的 `frankenphp` 替换为 debug FrankenPHP 可执行文件
|
||||
3. 照常启动 FrankenPHP(或者,你可以直接使用 GDB 启动 FrankenPHP: `gdb --args ./frankenphp run`)
|
||||
3. 照常启动 FrankenPHP(或者,你可以直接使用 GDB 启动 FrankenPHP: `gdb --args frankenphp run`)
|
||||
4. 使用 GDB 附加到进程:
|
||||
|
||||
```console
|
||||
@ -172,7 +172,7 @@ docker buildx bake -f docker-bake.hcl --pull --no-cache --push
|
||||
|
||||
```console
|
||||
go test -tags watcher -c -ldflags=-w
|
||||
gdb --args ./frankenphp.test -test.run ^MyTest$
|
||||
gdb --args frankenphp.test -test.run ^MyTest$
|
||||
```
|
||||
|
||||
9. 当错误修复后,恢复所有这些更改
|
||||
|
@ -35,7 +35,7 @@ docker run -p 80:80 -p 443:443 -p 443:443/udp -v $PWD:/app dunglas/frankenphp
|
||||
}
|
||||
```
|
||||
|
||||
3. 从 Laravel 项目的根目录启动 FrankenPHP:`./frankenphp run`
|
||||
3. 从 Laravel 项目的根目录启动 FrankenPHP:`frankenphp run`
|
||||
|
||||
## Laravel Octane
|
||||
|
||||
|
@ -22,7 +22,7 @@ docker run \
|
||||
使用 `php-server` 命令的 `--worker` 选项, 执行命令使当前目录的内容使用 worker:
|
||||
|
||||
```console
|
||||
./frankenphp php-server --worker /path/to/your/worker/script.php
|
||||
frankenphp php-server --worker /path/to/your/worker/script.php
|
||||
```
|
||||
|
||||
## Symfony Runtime
|
||||
|
@ -146,7 +146,7 @@ docker buildx bake -f docker-bake.hcl --pull --no-cache --push
|
||||
|
||||
```console
|
||||
go test -tags watcher -c -ldflags=-w
|
||||
gdb --args ./frankenphp.test -test.run ^MyTest$
|
||||
gdb --args frankenphp.test -test.run ^MyTest$
|
||||
```
|
||||
|
||||
9. Quand le bug est corrigé, annulez tous les changements
|
||||
|
@ -34,18 +34,27 @@ Rendez-vous sur `https://localhost`, c'est parti !
|
||||
### Binaire autonome
|
||||
|
||||
Si vous préférez ne pas utiliser Docker, nous fournissons des binaires autonomes de FrankenPHP pour Linux et macOS
|
||||
contenant [PHP 8.3](https://www.php.net/releases/8.3/fr.php) et la plupart des extensions PHP populaires : [Télécharger FrankenPHP](https://github.com/dunglas/frankenphp/releases)
|
||||
contenant [PHP 8.3](https://www.php.net/releases/8.3/fr.php) et la plupart des extensions PHP populaires.
|
||||
|
||||
Sous Windows, utilisez [WSL](https://learn.microsoft.com/windows/wsl/) pour exécuter FrankenPHP.
|
||||
|
||||
[Téléchargez FrankenPHP](https://github.com/dunglas/frankenphp/releases) ou copiez cette ligne dans votre terminal pour installer automatiquement la version appropriée à votre plateforme :
|
||||
|
||||
```console
|
||||
curl https://frankenphp.dev/install.sh | sh
|
||||
mv frankenphp /usr/local/bin/
|
||||
```
|
||||
|
||||
Pour servir le contenu du répertoire courant, exécutez :
|
||||
|
||||
```console
|
||||
./frankenphp php-server
|
||||
frankenphp php-server
|
||||
```
|
||||
|
||||
Vous pouvez également exécuter des scripts en ligne de commande avec :
|
||||
|
||||
```console
|
||||
./frankenphp php-cli /path/to/your/script.php
|
||||
frankenphp php-cli /path/to/your/script.php
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
@ -17,7 +17,7 @@ Et profitez !
|
||||
|
||||
Vous pouvez également exécuter vos projets Laravel avec FrankenPHP depuis votre machine locale :
|
||||
|
||||
1. [Téléchargez le binaire correspondant à votre système](https://github.com/dunglas/frankenphp/releases)
|
||||
1. [Téléchargez le binaire correspondant à votre système](README.md#binaire-autonome)
|
||||
2. Ajoutez la configuration suivante dans un fichier nommé `Caddyfile` placé dans le répertoire racine de votre projet Laravel :
|
||||
|
||||
```caddyfile
|
||||
@ -36,7 +36,7 @@ Vous pouvez également exécuter vos projets Laravel avec FrankenPHP depuis votr
|
||||
}
|
||||
```
|
||||
|
||||
3. Démarrez FrankenPHP depuis le répertoire racine de votre projet Laravel : `./frankenphp run`
|
||||
3. Démarrez FrankenPHP depuis le répertoire racine de votre projet Laravel : `frankenphp run`
|
||||
|
||||
## Laravel Octane
|
||||
|
||||
|
@ -22,7 +22,7 @@ docker run \
|
||||
Utilisez l'option --worker de la commande php-server pour servir le contenu du répertoire courant en utilisant un worker :
|
||||
|
||||
```console
|
||||
./frankenphp php-server --worker /path/to/your/worker/script.php
|
||||
frankenphp php-server --worker /path/to/your/worker/script.php
|
||||
```
|
||||
|
||||
Si votre application PHP est [intégrée dans le binaire](embed.md), vous pouvez également ajouter un `Caddyfile` personnalisé dans le répertoire racine de l'application.
|
||||
|
@ -35,7 +35,7 @@ Alternatively, you can run your Laravel projects with FrankenPHP from your local
|
||||
}
|
||||
```
|
||||
|
||||
3. Start FrankenPHP from the root directory of your Laravel project: `./frankenphp run`
|
||||
3. Start FrankenPHP from the root directory of your Laravel project: `frankenphp run`
|
||||
|
||||
## Laravel Octane
|
||||
|
||||
@ -128,25 +128,25 @@ Follow these steps to package your Laravel app as a standalone binary for Linux:
|
||||
4. Populate caches:
|
||||
|
||||
```console
|
||||
./frankenphp php-cli artisan optimize
|
||||
frankenphp php-cli artisan optimize
|
||||
```
|
||||
|
||||
5. Run database migrations (if any):
|
||||
|
||||
```console
|
||||
./frankenphp php-cli artisan migrate
|
||||
frankenphp php-cli artisan migrate
|
||||
````
|
||||
|
||||
6. Generate app's secret key:
|
||||
|
||||
```console
|
||||
./frankenphp php-cli artisan key:generate
|
||||
frankenphp php-cli artisan key:generate
|
||||
```
|
||||
|
||||
7. Start the server:
|
||||
|
||||
```console
|
||||
./frankenphp php-server
|
||||
frankenphp php-server
|
||||
```
|
||||
|
||||
Your app is now ready!
|
||||
@ -170,7 +170,7 @@ To do so, [install Octane properly](#laravel-octane) and follow the steps descri
|
||||
Then, to start FrankenPHP in worker mode through Octane, run:
|
||||
|
||||
```console
|
||||
PATH="$PWD:$PATH" ./frankenphp php-cli artisan octane:frankenphp
|
||||
PATH="$PWD:$PATH" frankenphp php-cli artisan octane:frankenphp
|
||||
```
|
||||
|
||||
> [!CAUTION]
|
||||
|
@ -118,7 +118,7 @@ docker buildx bake -f docker-bake.hcl --pull --no-cache --push
|
||||
```
|
||||
|
||||
2. Mevcut `frankenphp` sürümünüzü hata ayıklama FrankenPHP çalıştırılabilir dosyasıyla değiştirin
|
||||
3. FrankenPHP'yi her zamanki gibi başlatın (alternatif olarak FrankenPHP'yi doğrudan GDB ile başlatabilirsiniz: `gdb --args ./frankenphp run`)
|
||||
3. FrankenPHP'yi her zamanki gibi başlatın (alternatif olarak FrankenPHP'yi doğrudan GDB ile başlatabilirsiniz: `gdb --args frankenphp run`)
|
||||
4. GDB ile sürece bağlanın:
|
||||
|
||||
```console
|
||||
@ -172,7 +172,7 @@ docker buildx bake -f docker-bake.hcl --pull --no-cache --push
|
||||
|
||||
```console
|
||||
go test -tags watcher -c -ldflags=-w
|
||||
gdb --args ./frankenphp.test -test.run ^MyTest$
|
||||
gdb --args frankenphp.test -test.run ^MyTest$
|
||||
```
|
||||
|
||||
9. Hata düzeltildiğinde, tüm bu değişiklikleri geri alın
|
||||
|
@ -35,7 +35,7 @@ Alternatif olarak, Laravel projelerinizi FrankenPHP ile yerel makinenizden çal
|
||||
}
|
||||
```
|
||||
|
||||
3. FrankenPHP'yi Laravel projenizin kök dizininden başlatın: `./frankenphp run`
|
||||
3. FrankenPHP'yi Laravel projenizin kök dizininden başlatın: `frankenphp run`
|
||||
|
||||
## Laravel Octane
|
||||
|
||||
|
@ -22,7 +22,7 @@ docker run \
|
||||
Geçerli dizinin içeriğini bir worker kullanarak sunmak için `php-server` komutunun `--worker` seçeneğini kullanın:
|
||||
|
||||
```console
|
||||
./frankenphp php-server --worker /path/to/your/worker/script.php
|
||||
frankenphp php-server --worker /path/to/your/worker/script.php
|
||||
```
|
||||
|
||||
PHP uygulamanız [binary dosyaya gömülü](embed.md) ise, uygulamanın kök dizinine özel bir `Caddyfile` ekleyebilirsiniz.
|
||||
|
@ -22,7 +22,7 @@ docker run \
|
||||
Use the `--worker` option of the `php-server` command to serve the content of the current directory using a worker:
|
||||
|
||||
```console
|
||||
./frankenphp php-server --worker /path/to/your/worker/script.php
|
||||
frankenphp php-server --worker /path/to/your/worker/script.php
|
||||
```
|
||||
|
||||
If your PHP app is [embedded in the binary](embed.md), you can add a custom `Caddyfile` in the root directory of the app.
|
||||
@ -32,7 +32,7 @@ It's also possible to [restart the worker on file changes](config.md#watching-fo
|
||||
The following command will trigger a restart if any file ending in `.php` in the `/path/to/your/app/` directory or subdirectories is modified:
|
||||
|
||||
```console
|
||||
./frankenphp php-server --worker /path/to/your/worker/script.php --watch "/path/to/your/app/**/*.php"
|
||||
frankenphp php-server --worker /path/to/your/worker/script.php --watch "/path/to/your/app/**/*.php"
|
||||
```
|
||||
|
||||
## Symfony Runtime
|
||||
|
31
install.sh
31
install.sh
@ -12,6 +12,12 @@ DEST=${BIN_DIR}/frankenphp
|
||||
OS=$(uname -s)
|
||||
ARCH=$(uname -m)
|
||||
|
||||
if type "tput" >/dev/null 2>&1; then
|
||||
bold=$(tput bold)
|
||||
italic=$(tput sitm)
|
||||
normal=$(tput sgr0)
|
||||
fi
|
||||
|
||||
case ${OS} in
|
||||
Linux*)
|
||||
case ${ARCH} in
|
||||
@ -37,7 +43,7 @@ Darwin*)
|
||||
esac
|
||||
;;
|
||||
Windows | MINGW64_NT*)
|
||||
echo "Install and use WSL to use FrankenPHP on Windows: https://learn.microsoft.com/windows/wsl/"
|
||||
echo "❗ Use WSL to run FrankenPHP on Windows: https://learn.microsoft.com/windows/wsl/"
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
@ -46,24 +52,37 @@ Windows | MINGW64_NT*)
|
||||
esac
|
||||
|
||||
if [ -z "${THE_ARCH_BIN}" ]; then
|
||||
echo "FrankenPHP is not supported on ${OS} and ${ARCH}"
|
||||
echo "❗ FrankenPHP is not supported on ${OS} and ${ARCH}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SUDO=""
|
||||
|
||||
echo "📦 Downloading ${bold}FrankenPHP${normal} for ${OS} (${ARCH}):"
|
||||
|
||||
# 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"
|
||||
echo "❗ You do not have permission to write to ${italic}${DEST}${normal}, enter your password to grant sudo powers"
|
||||
SUDO="sudo"
|
||||
fi
|
||||
|
||||
${SUDO} curl -L --progress-bar "https://github.com/dunglas/frankenphp/releases/latest/download/${THE_ARCH_BIN}" -o "${DEST}"
|
||||
if type "curl" >/dev/null 2>&1; then
|
||||
curl -L --progress-bar "https://github.com/dunglas/frankenphp/releases/latest/download/${THE_ARCH_BIN}" -o "${DEST}"
|
||||
elif type "wget" >/dev/null 2>&1; then
|
||||
${SUDO} wget "https://github.com/dunglas/frankenphp/releases/latest/download/${THE_ARCH_BIN}" -O "${DEST}"
|
||||
else
|
||||
echo "❗ Please install ${italic}curl${normal} or ${italic}wget${normal} to download FrankenPHP"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
${SUDO} chmod +x "${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/"
|
||||
echo
|
||||
echo "🥳 FrankenPHP downloaded successfully to ${italic}${DEST}${normal}"
|
||||
echo "🔧 Move the binary to ${italic}/usr/local/bin/${normal} or another directory in your ${italic}PATH${normal} to use it globally:"
|
||||
echo " ${bold}sudo mv ${DEST} /usr/local/bin/${normal}"
|
||||
echo
|
||||
echo "⭐ If you like FrankenPHP, please give it a star on GitHub: ${italic}https://github.com/dunglas/frankenphp${normal}"
|
||||
|
Loading…
Reference in New Issue
Block a user