Skip to content
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

Do not require restart when PHP installation(s) change #219

Closed
mchev opened this issue Jan 7, 2023 · 3 comments
Closed

Do not require restart when PHP installation(s) change #219

mchev opened this issue Jan 7, 2023 · 3 comments
Assignees
Labels
enhancement New feature or request. implemented & available via early access Available in Early Access preview for sponsors.
Milestone

Comments

@mchev
Copy link

mchev commented Jan 7, 2023

Describe the bug
I type brew upgrade sometimes and it seems to clean all the older versions of PHP except the linked one. The problem is that those versions are still displayed in the phpmon menu. When i try to switch to a version that has been removed, phpmon crashes with no error message. If i reinstall for example php@8.1 with brew and i try to switch to this version it is working again.

To Reproduce
Steps to reproduce the behavior:

  1. use PHP@8.2 as default PHP version
  2. brew upgrade (global)
  3. try to switch to an older version of PHP
  4. Crash

Expected behavior
I probably shouldn't use the brew upgradecommand but it took me some minutes to figure out that the PHP version was missing. An error message with these informations would be great. Like :
"The version you're trying to use is missing, type "brew install php@x.x" to fix that isssue."
Or even better, if the version is missing, auto-install it.

Required information

  • Did you consult the FAQ in the README? [yes]
  • Did you try "Fix My Valet"? [yes]
  • OS: [e.g. macOS Ventura 13.0.1]
  • PHP Monitor version [Version 5.6.6 (992)]
@mchev mchev added the bug Something isn't working (correctly). label Jan 7, 2023
@nicoverbruggen
Copy link
Owner

This is currently expected behaviour.

PHP Monitor only checks which versions of PHP are installed at startup, so if you install or remove a version of PHP, you need to restart PHP Monitor afterwards.

I have plans to improve this in v6, so I'll keep the issue open.

@nicoverbruggen nicoverbruggen added enhancement New feature or request. and removed bug Something isn't working (correctly). labels Jan 7, 2023
@nicoverbruggen nicoverbruggen added this to the v6.0 milestone Jan 7, 2023
@nicoverbruggen nicoverbruggen changed the title Crash when trying to switch to an uninstalled PHP version Do not require restart when PHP installation(s) change Jan 7, 2023
@mchev
Copy link
Author

mchev commented Jan 7, 2023

The list is not updated after a restart. That's why i opened this issue.
It's seems that when i uninstall manually the PHP versions list is updated but when i use the brew upgrade command, even if i restart phpmon, some PHP versions are missing but phpmon still see it as installed. I will try to reproduce each of the steps to see in more detail when there is unexpected behavior.

@nicoverbruggen
Copy link
Owner

nicoverbruggen commented Jan 7, 2023

If that's the case, there's likely something else going on: likely a permission issue with cleanup. It's quite common and I've seen this happen to other folks. Try running brew doctor and let me know if it reports anything out of the ordinary.

PHP Monitor will only list PHP versions if the actual binary file is present and the symlinked folder is present in the Homebrew folder. Likely, the formula was uninstalled but some linked folders and executables remain, which would make them appear in PHP Monitor's list (but make Homebrew think they were removed).

For more extensive troubleshooting perhaps it's better if you could make this a separate discussion thread instead. And of course, thanks for reporting!

P.S. You can avoid some of these cleanup issues by simply stopping Valet before running Homebrew commands. valet stop should be sufficient. A while ago, I made a PR for Valet that ensures the file and folder permissions are corrected after terminating the services (Valet runs services as root, making some of them unavailable to be cleaned up while Valet remains active).

@nicoverbruggen nicoverbruggen added the WIP on dev Working on this in the development branch. label Feb 13, 2023
@nicoverbruggen nicoverbruggen added fixed in upcoming release Fixed in the upcoming release! and removed WIP on dev Working on this in the development branch. labels Mar 3, 2023
@nicoverbruggen nicoverbruggen added implemented & available via early access Available in Early Access preview for sponsors. and removed fixed in upcoming release Fixed in the upcoming release! labels Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request. implemented & available via early access Available in Early Access preview for sponsors.
Projects
None yet
Development

No branches or pull requests

2 participants