Skip to content

Conversation

@saibotk
Copy link
Contributor

@saibotk saibotk commented Apr 15, 2025

This previously only reapplied the configuration for the linked version. Because it is recommended to run valet install again after a brew upgrade, it is necessary to update all utilized PHP versions.

On brew upgrades, some versions received the default www.conf again. This would leave the user with a broken setup until they either call valet use php@X.X for all the versions or isolate a site again with the version.

This commit fixes the behavior by rerunning the configuration step on all php versions. This is more consistent, because in the next line all utilized PHP versions are also restarted.

Seems like this also solves issues like #1410 or at least lets them only rerun a single valet install, which is something users would do in a regular troubleshooting session.

This previously only reapplied the configuration for the linked version.
Because it is recommended to run valet install again after a brew upgrade, it is necessary to update all utilized PHP versions.

On brew upgrades, some versions received the default www.conf again. This would leave the user with a broken setup until they either call `valet use php@X.X` for all the versions or isolate a site again with the version.

This commit fixes the behavior by rerunning the configuration step on all php versions. This is more consistent, because in the next line all utilized PHP versions are also restarted.
@drbyte
Copy link
Contributor

drbyte commented Apr 17, 2025

Agreed. 👍

/cc @mattstauffer

@mattstauffer
Copy link
Collaborator

OOO great find--thanks so much!

@mattstauffer mattstauffer merged commit 88e3c7b into laravel:master Apr 17, 2025
7 checks passed
saibotk added a commit to saibotk/valet that referenced this pull request Apr 25, 2025
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 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.
saibotk added a commit to saibotk/valet that referenced this pull request Apr 25, 2025
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 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.
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