Skip to content

Commit fc1b067

Browse files
committed
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 [email protected] 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 `[email protected]`, 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.
1 parent 2c6a935 commit fc1b067

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

cli/Valet/Brew.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ public function getParsedLinkedPhp(): array
259259
}
260260

261261
/**
262-
* Gets the currently linked formula by identifying the symlink in the hombrew bin directory.
262+
* Gets the currently linked formula by identifying the symlink in the homebrew bin directory.
263263
* Different to ->linkedPhp() in that this will just get the linked directory name,
264264
* whether that is php, php74 or [email protected].
265265
*/

cli/Valet/PhpFpm.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ public function install(): void
3737

3838
$this->restart();
3939

40-
$this->symlinkPrimaryValetSock($phpVersion);
40+
$linkedPhpVersion = $this->brew->linkedPhp();
41+
$this->symlinkPrimaryValetSock($linkedPhpVersion);
4142
}
4243

4344
/**
@@ -331,6 +332,6 @@ public function utilizedPhpVersions(): array
331332
return $this->normalizePhpVersion(str_replace(['valet', '.sock'], '', $sock));
332333
}
333334
}
334-
})->merge([$this->brew->getLinkedPhpFormula()])->filter()->unique()->values()->toArray();
335+
})->merge([$this->brew->linkedPhp()])->filter()->unique()->values()->toArray();
335336
}
336337
}

0 commit comments

Comments
 (0)