#!/bin/bash # Download static PHP binaries for all platforms. # Run from the electron/ directory. set -e cd "$(dirname "$0")/php-bin" BASE="https://dl.static-php.dev/static-php-cli/common" # Find latest 8.3.x version echo "Finding latest PHP 8.3 version..." VERSION=$(curl -sL "$BASE/" | grep -oP 'php-8\.3\.\d+-cli-linux-x86_64' | sort -V | tail -1 | grep -oP '8\.3\.\d+') if [ -z "$VERSION" ]; then echo "ERROR: Could not determine latest PHP 8.3 version." exit 1 fi echo "Using PHP $VERSION" # Linux x86_64 echo " linux..." curl -fSL "$BASE/php-${VERSION}-cli-linux-x86_64.tar.gz" -o /tmp/php-linux.tar.gz tar -xzf /tmp/php-linux.tar.gz -C linux/ chmod +x linux/php rm /tmp/php-linux.tar.gz # macOS arm64 echo " darwin..." curl -fSL "$BASE/php-${VERSION}-cli-macos-aarch64.tar.gz" -o /tmp/php-darwin.tar.gz tar -xzf /tmp/php-darwin.tar.gz -C darwin/ chmod +x darwin/php rm /tmp/php-darwin.tar.gz # Windows — static-php-cli doesn't ship Windows builds, # so we skip it here. For Windows, bundle PHP from https://windows.php.net/download/ echo " win32: skipped (no static build available — use windows.php.net)" echo "" echo "Done: PHP $VERSION" ls -lh linux/php darwin/php 2>/dev/null