1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-04 08:10:07 +01:00
This commit is contained in:
NasirNobin
2022-03-22 01:52:51 +06:00
parent 3d85b44e6a
commit b7880793a9
2 changed files with 9 additions and 18 deletions

View File

@@ -309,6 +309,7 @@ function ($version) use ($resolvedPhpVersion) {
public function getPhpBinaryPath($phpVersion)
{
$versionInteger = preg_replace('~[^\d]~', '', $phpVersion);
$binPath = null;
if (file_exists(BREW_PREFIX . "/bin/valetphp{$versionInteger}")) {
return BREW_PREFIX . "/bin/valetphp{$versionInteger}";
@@ -320,30 +321,21 @@ public function getPhpBinaryPath($phpVersion)
$path = !empty($details[0]->linked_keg) ? $details[0]->linked_keg : $details[0]->installed[0]->version;
if (file_exists(trim($cellar).'/'.$path.'/bin/php')) {
return trim($cellar).'/'.$path.'/bin/php';
$binPath = trim($cellar).'/'.$path.'/bin/php';
}
if (file_exists(BREW_PREFIX . "/opt/$phpVersion/bin/php")) {
return BREW_PREFIX . "/opt/$phpVersion/bin/php";
// if (!$binPath && file_exists(BREW_PREFIX . "/opt/$phpVersion/bin/php")) {
// return BREW_PREFIX . "/opt/$phpVersion/bin/php";
// }
if($binPath){
$this->files->symlinkAsUser($binPath, BREW_PREFIX . "/bin/valetphp{$versionInteger}");
return $binPath;
}
return "php";
}
/**
* Create a PHP binary symlink for a PHP version
*
* @param string $phpVersion
*
* @return void
*/
public function symlinkPhpBinary($phpVersion)
{
$versionInteger = preg_replace('~[^\d]~', '', $phpVersion);
$this->files->symlinkAsUser($this->getPhpBinaryPath($phpVersion), BREW_PREFIX . "/bin/valetphp{$versionInteger}");
}
/**
* Restart the linked PHP-FPM Homebrew service.
*