mirror of
https://github.com/laravel/valet.git
synced 2026-02-06 08:40:09 +01:00
fix(php-fpm): correct socket creation
While my PR #1514 fixed recreating the FPM configs, it introduced a different issue: Due to the use of `utilizedPhpVersions()`, the code now also configured the FPM config for the alias `php` version. This caused it to invoke the configure function with an empty version string and thus overwriting the FPM config for (in my case) the php@8.4 config templated with `valet.sock` instead of the correct `valet84.sock`. The nginx sites that were configured to proxy their requests to the `valet84.sock` then failed because it did not exist anymore. We fixed this by always including the actual linked PHP version via the `linkedPhp` function. This returns `php8.4` instead of `php`. `php` is an alias anyway and this also removes another unnecessary service restart call. Previously, this would also try to restart the `php` service via brew which was already restarted through the restart of `php@8.4`, which is an alias in brew. This also fixes an issue with the previous PR, to correctly symlink `valet.sock` again to the linked PHP version, which we oversaw.
This commit is contained in:
@@ -259,7 +259,7 @@ public function getParsedLinkedPhp(): array
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the currently linked formula by identifying the symlink in the hombrew bin directory.
|
||||
* Gets the currently linked formula by identifying the symlink in the homebrew bin directory.
|
||||
* Different to ->linkedPhp() in that this will just get the linked directory name,
|
||||
* whether that is php, php74 or php@7.4.
|
||||
*/
|
||||
|
||||
@@ -37,7 +37,8 @@ public function install(): void
|
||||
|
||||
$this->restart();
|
||||
|
||||
$this->symlinkPrimaryValetSock($phpVersion);
|
||||
$linkedPhpVersion = $this->brew->linkedPhp();
|
||||
$this->symlinkPrimaryValetSock($linkedPhpVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -331,6 +332,6 @@ public function utilizedPhpVersions(): array
|
||||
return $this->normalizePhpVersion(str_replace(['valet', '.sock'], '', $sock));
|
||||
}
|
||||
}
|
||||
})->merge([$this->brew->getLinkedPhpFormula()])->filter()->unique()->values()->toArray();
|
||||
})->merge([$this->brew->linkedPhp()])->filter()->unique()->values()->toArray();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user