mirror of
https://github.com/laravel/valet.git
synced 2026-02-05 08:30:07 +01:00
Add quotes around $PHP (#1431)
If the PHP executable path has a space in it, it breaks valet. For example, when using the new Laravel Herd which stores its config and binaries under `~/Library/Application Support/Herd/...`
This commit is contained in:
16
valet
16
valet
@@ -23,21 +23,21 @@ fi
|
|||||||
# Get a command-line executable we can use for php that's 8+; if this
|
# Get a command-line executable we can use for php that's 8+; if this
|
||||||
# is the inside loop (Valet runs itself 2x in some settings), skip
|
# is the inside loop (Valet runs itself 2x in some settings), skip
|
||||||
# checking and pulling again by reading the exported env var
|
# checking and pulling again by reading the exported env var
|
||||||
if [[ $PHP_EXECUTABLE = "" ]]
|
if [[ "$PHP_EXECUTABLE" = "" ]]
|
||||||
then
|
then
|
||||||
PHP=$(php $DIR/find-usable-php.php)
|
PHP="$(php $DIR/find-usable-php.php)"
|
||||||
|
|
||||||
# Validate output before running it on the CLI
|
# Validate output before running it on the CLI
|
||||||
if [[ ! -f $PHP ]]; then
|
if [[ ! -f "$PHP" ]]; then
|
||||||
echo "Error finding executable PHP. Quitting for safety."
|
echo "Error finding executable PHP. Quitting for safety."
|
||||||
echo "Provided output from find-usable-php.php:"
|
echo "Provided output from find-usable-php.php:"
|
||||||
echo $PHP
|
echo $PHP
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export PHP_EXECUTABLE=$PHP
|
export PHP_EXECUTABLE="$PHP"
|
||||||
else
|
else
|
||||||
PHP=$PHP_EXECUTABLE
|
PHP="$PHP_EXECUTABLE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If the command is the "share" command we will need to resolve out any
|
# If the command is the "share" command we will need to resolve out any
|
||||||
@@ -81,7 +81,7 @@ then
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
TLD=$($PHP "$DIR/cli/valet.php" tld)
|
TLD=$("$PHP" "$DIR/cli/valet.php" tld)
|
||||||
|
|
||||||
# Decide the correct PORT: uses 60 for secure, else 80
|
# Decide the correct PORT: uses 60 for secure, else 80
|
||||||
if grep --quiet --no-messages 443 ~/.config/valet/Nginx/$HOST*
|
if grep --quiet --no-messages 443 ~/.config/valet/Nginx/$HOST*
|
||||||
@@ -124,7 +124,7 @@ then
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
TLD=$($PHP "$DIR/cli/valet.php" tld)
|
TLD=$("$PHP" "$DIR/cli/valet.php" tld)
|
||||||
|
|
||||||
# Decide the correct PORT: uses 443 for secure, else 80
|
# Decide the correct PORT: uses 443 for secure, else 80
|
||||||
if grep --quiet --no-messages 443 ~/.config/valet/Nginx/$HOST*
|
if grep --quiet --no-messages 443 ~/.config/valet/Nginx/$HOST*
|
||||||
@@ -182,5 +182,5 @@ else
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$PHP "$DIR/cli/valet.php" "$@"
|
"$PHP" "$DIR/cli/valet.php" "$@"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user