Last active
August 23, 2022 11:57
-
-
Save glensc/405108d6f175a3d202dee8fd507ef5da to your computer and use it in GitHub Desktop.
brew and phpXY in PATH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*~ | |
/php?? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
dir=$(dirname "$0") | |
for php in \ | |
/usr/local/opt/php/bin/php \ | |
/opt/homebrew/opt/php/bin/php \ | |
/usr/local/Cellar/php*/*/bin/php \ | |
/usr/local/opt/php@*/bin/php \ | |
/opt/homebrew/opt/php@*/bin/php \ | |
; do | |
version=$($php -d display_errors=off -r 'echo PHP_MAJOR_VERSION, PHP_MINOR_VERSION;' 2>/dev/null) || continue | |
target="$dir/php$version" | |
ln -snf "$php" "$target" | |
ls -ld "$target" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment