Skip to content

fix(php-fpm): correct socket creation #1515

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 28, 2025

Conversation

saibotk
Copy link
Contributor

@saibotk saibotk commented Apr 25, 2025

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.

So e.g. on my system it returned these versions:

This caused it to invoke the configure function 4 times, once for each version.
For php it was invoked with an empty version string argument and thus caused overwriting the FPM config for (in my case) [email protected], 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, so we only get the 3 actual PHP versions.

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. We also fixed a small comment typo.

While my PR laravel#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.
@saibotk saibotk force-pushed the fix-php-fpm-config branch from fc1b067 to 0525673 Compare April 25, 2025 21:03
@drbyte
Copy link
Contributor

drbyte commented Apr 28, 2025

👍

/cc @mattstauffer

@mattstauffer mattstauffer merged commit 66b7d43 into laravel:master Apr 28, 2025
5 checks passed
@mattstauffer
Copy link
Collaborator

Brilliant, thanks so much for catching this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants