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

Crash when switch to PHP 8.2 #162

Closed
huangdijia opened this issue Apr 17, 2022 · 19 comments
Closed

Crash when switch to PHP 8.2 #162

huangdijia opened this issue Apr 17, 2022 · 19 comments
Assignees
Labels
bug Something isn't working (correctly). fixed in upcoming release Fixed in the upcoming release!

Comments

@huangdijia
Copy link

Crash when switch to PHP 8.2

@huangdijia huangdijia added the bug Something isn't working (correctly). label Apr 17, 2022
@nicoverbruggen
Copy link
Owner

Please locate and attach the crash log, and I can take a look. Without more information, I cannot help you.

You can find out how to do so in the README.

@nicoverbruggen nicoverbruggen added the more information needed Sadly, not enough info. label Apr 18, 2022
@huangdijia
Copy link
Author

Nothing to show, and I can not found crash log.

@nicoverbruggen
Copy link
Owner

Hmm... Are there any crash reports in /Applications/Utilities/Console.app? (Under Reports > Crash Reports). Without a crash log, I currently cannot determine what is going wrong, sadly :(

The other thing you can try is launching PHP Monitor via the terminal and reporting the output. You can launch the app via the terminal this way:

open /Applications/PHP\ Monitor.app/Contents/MacOS/PHP\ Monitor

That should show you some output, like this:

-> % /Applications/PHP\ Monitor.app/Contents/MacOS/PHP\ Monitor ; exit;
==================================
PHP MONITOR by Nico Verbruggen
Version 5.2.1 (757)
==================================
[ARCH] The user is running PHP Monitor with the architecture: arm64
[OK] `/opt/homebrew/bin/brew` exists
[OK] `/opt/homebrew/bin/php` exists
[W] PHP Monitor does not have permission to show notifications.
[E] PHP Monitor encounted an error determining notification permissions:
[E] Error Domain=UNErrorDomain Code=1 "Notifications are not allowed for this application" UserInfo={NSLocalizedDescription=Notifications are not allowed for this application}
[OK] `ls /opt/homebrew/opt | grep php` returned php result
[OK] `valet` binary exists
...

You can use the app like normal, and try switching then. Do you get any errors or crashes as reported in the terminal? In case none of that helps, I do have the following generic advice:

Have you tried the First Aid options in the app? If you're having issues, I can also recommend reinstalling the Homebrew dependencies, i.e.:

brew reinstall php
brew reinstall [email protected]

At the very least, the interactive log from the app if launching through the terminal should be of some use if the app does indeed crash, and you might find the crash logs in Console.app instead. Good luck, and please report back if you find more info that could help me here!

@huangdijia
Copy link
Author

huangdijia commented Apr 19, 2022

Run '/Applications/PHP Monitor.app/Contents/MacOS/PHP Monitor'; exit

Output when using php 8.0:

==================================
PHP MONITOR by Nico Verbruggen
Version 5.2.1 (757)
==================================
[ARCH] The user is running PHP Monitor with the architecture: arm64
[OK] `/opt/homebrew/bin/brew` exists
[OK] `/opt/homebrew/bin/php` exists
[OK] `ls /opt/homebrew/opt | grep php` returned php result
[OK] `valet` binary exists
[OK] `/private/etc/sudoers.d/brew` contains brew
[OK] `/private/etc/sudoers.d/valet` contains valet
[OK] `sudo /opt/homebrew/bin/brew services info` JSON loaded
[OK] `config.json` was valid
[OK] `valet --version` was loaded
==================================
PHP Monitor has determined the application has successfully passed all checks.
When on your system, the `php` formula means version 8.1!
Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “pm70” in the folder “bin”." UserInfo={NSFilePath=/usr/local/bin/pm70, NSUserStringVariant=Folder, NSUnderlyingError=0x600000f31c80 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}
[E] Could not write PHP Monitor helper for PHP 7.0 to /usr/local/bin/pm70
Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “pm71” in the folder “bin”." UserInfo={NSFilePath=/usr/local/bin/pm71, NSUserStringVariant=Folder, NSUnderlyingError=0x600000f37270 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}
[E] Could not write PHP Monitor helper for PHP 7.1 to /usr/local/bin/pm71
Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “pm72” in the folder “bin”." UserInfo={NSFilePath=/usr/local/bin/pm72, NSUserStringVariant=Folder, NSUnderlyingError=0x600000f374b0 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}
[E] Could not write PHP Monitor helper for PHP 7.2 to /usr/local/bin/pm72
Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “pm73” in the folder “bin”." UserInfo={NSFilePath=/usr/local/bin/pm73, NSUserStringVariant=Folder, NSUnderlyingError=0x600000f376c0 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}
[E] Could not write PHP Monitor helper for PHP 7.3 to /usr/local/bin/pm73
Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “pm74” in the folder “bin”." UserInfo={NSFilePath=/usr/local/bin/pm74, NSUserStringVariant=Folder, NSUnderlyingError=0x600000f378d0 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}
[E] Could not write PHP Monitor helper for PHP 7.4 to /usr/local/bin/pm74
Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “pm80” in the folder “bin”." UserInfo={NSFilePath=/usr/local/bin/pm80, NSUserStringVariant=Folder, NSUnderlyingError=0x600000f37ae0 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}
[E] Could not write PHP Monitor helper for PHP 8.0 to /usr/local/bin/pm80
Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “pm81” in the folder “bin”." UserInfo={NSFilePath=/usr/local/bin/pm81, NSUserStringVariant=Folder, NSUnderlyingError=0x600000f37cf0 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}
[E] Could not write PHP Monitor helper for PHP 8.1 to /usr/local/bin/pm81
Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “pm82” in the folder “bin”." UserInfo={NSFilePath=/usr/local/bin/pm82, NSUserStringVariant=Folder, NSUnderlyingError=0x600000f37e70 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}
[E] Could not write PHP Monitor helper for PHP 8.2 to /usr/local/bin/pm82
The PHP versions that were detected are: ["7.0", "7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2"]
The user DOES have the following tapped: shivammathur/php
Checking for `php` formula conflicts...
All seems to be OK. No conflicts, both are PHP 8.1.
Determining broken PHP-FPM...
Setting up watchers...
Detecting applications...
There was no .phpmon.conf.json file to be loaded.
No watcher currently active...
Detected applications: ["Visual Studio Code", "iTerm"]
No global hotkey was saved in preferences. None set.
PHP Monitor has extracted the version number of Valet: 3.1.3
This version of Valet supports isolation.
Valet version 3.1.3 is recent enough, OK (recommended: 2.16.2)
Fewer than or 50 sites found, preloading list of sites...
PHP Monitor is ready to serve!

Output when using php8.2:

==================================
PHP MONITOR by Nico Verbruggen
Version 5.2.1 (757)
==================================
[ARCH] The user is running PHP Monitor with the architecture: arm64
[OK] `/opt/homebrew/bin/brew` exists
[OK] `/opt/homebrew/bin/php` exists
[OK] `ls /opt/homebrew/opt | grep php` returned php result
[OK] `valet` binary exists
[OK] `/private/etc/sudoers.d/brew` contains brew
[OK] `/private/etc/sudoers.d/valet` contains valet
[OK] `sudo /opt/homebrew/bin/brew services info` JSON loaded
[OK] `config.json` was valid
[OK] `valet --version` was loaded
==================================
PHP Monitor has determined the application has successfully passed all checks.
When on your system, the `php` formula means version 8.1!
Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “pm70” in the folder “bin”." UserInfo={NSFilePath=/usr/local/bin/pm70, NSUserStringVariant=Folder, NSUnderlyingError=0x60000096de00 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}
[E] Could not write PHP Monitor helper for PHP 7.0 to /usr/local/bin/pm70
Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “pm71” in the folder “bin”." UserInfo={NSFilePath=/usr/local/bin/pm71, NSUserStringVariant=Folder, NSUnderlyingError=0x60000093bf00 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}
[E] Could not write PHP Monitor helper for PHP 7.1 to /usr/local/bin/pm71
Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “pm72” in the folder “bin”." UserInfo={NSFilePath=/usr/local/bin/pm72, NSUserStringVariant=Folder, NSUnderlyingError=0x600000934150 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}
[E] Could not write PHP Monitor helper for PHP 7.2 to /usr/local/bin/pm72
Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “pm73” in the folder “bin”." UserInfo={NSFilePath=/usr/local/bin/pm73, NSUserStringVariant=Folder, NSUnderlyingError=0x6000009343c0 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}
[E] Could not write PHP Monitor helper for PHP 7.3 to /usr/local/bin/pm73
Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “pm74” in the folder “bin”." UserInfo={NSFilePath=/usr/local/bin/pm74, NSUserStringVariant=Folder, NSUnderlyingError=0x6000009345d0 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}
[E] Could not write PHP Monitor helper for PHP 7.4 to /usr/local/bin/pm74
Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “pm80” in the folder “bin”." UserInfo={NSFilePath=/usr/local/bin/pm80, NSUserStringVariant=Folder, NSUnderlyingError=0x6000009347e0 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}
[E] Could not write PHP Monitor helper for PHP 8.0 to /usr/local/bin/pm80
Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “pm81” in the folder “bin”." UserInfo={NSFilePath=/usr/local/bin/pm81, NSUserStringVariant=Folder, NSUnderlyingError=0x6000009349f0 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}
[E] Could not write PHP Monitor helper for PHP 8.1 to /usr/local/bin/pm81
Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “pm82” in the folder “bin”." UserInfo={NSFilePath=/usr/local/bin/pm82, NSUserStringVariant=Folder, NSUnderlyingError=0x600000934c00 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}
[E] Could not write PHP Monitor helper for PHP 8.2 to /usr/local/bin/pm82
The PHP versions that were detected are: ["7.0", "7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2"]
The user DOES have the following tapped: shivammathur/php
Checking for `php` formula conflicts...
All seems to be OK. No conflicts, both are PHP 8.1.
Determining broken PHP-FPM...
Setting up watchers...
Detecting applications...
There was no .phpmon.conf.json file to be loaded.
Detected applications: ["Visual Studio Code", "iTerm"]
No global hotkey was saved in preferences. None set.
PHP Monitor has extracted the version number of Valet: 3.1.3
This version of Valet supports isolation.
Valet version 3.1.3 is recent enough, OK (recommended: 2.16.2)
Fewer than or 50 sites found, preloading list of sites...
[1]    97004 trace trap  '/Applications/PHP Monitor.app/Contents/MacOS/PHP Monitor'

Saving session...completed.

@huangdijia
Copy link
Author

Homebrew installed on /opt/homebrew,not /usr/homebrew

@nicoverbruggen
Copy link
Owner

nicoverbruggen commented Apr 20, 2022

So, I noticed this line:

[1]    97004 trace trap  '/Applications/PHP Monitor.app/Contents/MacOS/PHP Monitor'

The app did indeed crash. So there should be a crash log somewhere! Can you tell me the output of:

cd ~/Library/Logs/DiagnosticReports && ls -la

@huangdijia
Copy link
Author

~ » cd ~/Library/Logs/DiagnosticReports && ls -la                                                                                                                           1 ↵ hdj@huangdijiadeMacBook-Air
total 304
drwxrwx---  20 root  _analyticsusers    640  4 20 12:02 .
drwxr-xr-x@ 40 hdj   staff             1280  4 15 09:11 ..
-rw-------@  1 hdj   _analyticsusers   9807  4 14 08:15 Moom-2022-04-14-081520.ips
-rw-------@  1 hdj   _analyticsusers  18744  4 18 07:36 PHP Monitor-2022-04-18-073602.ips
-rw-------@  1 hdj   _analyticsusers  20788  4 20 07:13 PHP Monitor-2022-04-20-071350.ips
-rw-------@  1 hdj   _analyticsusers  27362  4 20 07:15 PHP Monitor-2022-04-20-071513.ips
drwxrwx---   2 root  _analyticsusers     64  4 11 20:27 Retired
-rw-------@  1 hdj   _analyticsusers  17496  4 14 08:15 RunCatLauncher-2022-04-14-081519.ips
-rw-------@  1 hdj   _analyticsusers    321  4 19 10:59 SiriSearchFeedback-2022-04-19-105923.diag
-rw-------@  1 hdj   _analyticsusers    323  4 19 10:59 SiriSearchFeedback-2022-04-19-105924.diag
-rw-------@  1 hdj   _analyticsusers    321  4 19 11:30 SiriSearchFeedback-2022-04-19-113027.diag
-rw-------@  1 hdj   _analyticsusers    321  4 19 15:20 SiriSearchFeedback-2022-04-19-152042.diag
-rw-------@  1 hdj   _analyticsusers    321  4 19 19:11 SiriSearchFeedback-2022-04-19-191138.diag
-rw-------@  1 hdj   _analyticsusers    321  4 19 19:41 SiriSearchFeedback-2022-04-19-194140.diag
-rw-------@  1 hdj   _analyticsusers    321  4 19 23:31 SiriSearchFeedback-2022-04-19-233156.diag
-rw-------@  1 hdj   _analyticsusers    321  4 20 03:22 SiriSearchFeedback-2022-04-20-032212.diag
-rw-------@  1 hdj   _analyticsusers    321  4 20 03:52 SiriSearchFeedback-2022-04-20-035213.diag
-rw-------@  1 hdj   _analyticsusers    321  4 20 07:42 SiriSearchFeedback-2022-04-20-074229.diag
-rw-------@  1 hdj   _analyticsusers    321  4 20 11:32 SiriSearchFeedback-2022-04-20-113242.diag
-rw-------@  1 hdj   _analyticsusers    321  4 20 12:02 SiriSearchFeedback-2022-04-20-120244.diag

@nicoverbruggen
Copy link
Owner

Aha, so there you go! There are some crash logs here. Can you run open ~/Library/Logs/DiagnosticReports, which will open the Finder, zip up the PHP Monitor-xxx.ips files and attach them here? Thanks!

@huangdijia
Copy link
Author

归档.zip

@nicoverbruggen
Copy link
Owner

Thanks! I can reproduce the issue now, and I will attempt to have this fixed when I'm done with work :)

@huangdijia
Copy link
Author

Thanks! I can reproduce the issue now, and I will attempt to have this fixed when I'm done with work :)

Thanks!

nicoverbruggen added a commit that referenced this issue Apr 20, 2022
- Renaming the configuration files from `www.conf` to the backup
  (`disabled-by-phpmon`) will now succeed if the `disabled-by-phpmon`
  file already exists. This would fail if the `disabled-by-phpmon` file
  already existed in previous builds.

- The PHP-FPM alert when there's an issue with a missing socket
  configuration file has been tweaked and now contains a workaround if
  you want to run a newer version of PHP (e.g. PHP 8.2) that is not
  officially supported by Valet yet.

- When attempting to list the PHP version numbers, the `parse()` method
  is now used, as opposed to `PhpVersionNumber.make()`, which couldn't
  correctly handle pre-release versions of PHP.

- Updated tests to reflect these changes to `PhpVersionNumber`.
@nicoverbruggen
Copy link
Owner

Okay, so I was able to fix the crash, but sadly Valet does not officially support PHP 8.2 yet.

No worries, there is a workaround: you can fix this by going to ~/.composer/vendor/laravel/valet/cli/Valet/Brew.php and add [email protected] to the SUPPORTED_PHP_VERSIONS array. After that, try running valet install. This will ensure all the sockets etc. are configured correctly. (The app will suggest this workaround now as well.)

Thanks for bringing this to my attention.

You can try a build with this fix here.

Let me know if this build in combination with the workaround fixes your issue.

If it all works correctly, I will release that build as the new bugfix release (v5.2.2) later this week.

@nicoverbruggen nicoverbruggen added possibly fixed Possible fixed after troubleshooting but open for additional feedback (or similar reports) and removed more information needed Sadly, not enough info. labels Apr 20, 2022
@huangdijia
Copy link
Author

image

image

@nicoverbruggen
Copy link
Owner

Looks like it doesn't crash anymore? :)

Does the workaround I describe in the alert work for you? (Adding [email protected] to the SUPPORTED_PHP_VERSIONS and running valet install again.)

@huangdijia
Copy link
Author

image

Stop after output `Installing nginx directory...`

@nicoverbruggen
Copy link
Owner

This is a known issue with Valet. Here's the workaround:

security authorizationdb read com.apple.trust-settings.admin > ~/.config/valet/apple-trust-settings > /dev/null 2>& 1
sudo security authorizationdb write com.apple.trust-settings.admin allow > /dev/null 2>& 1

Run that first, and valet install after. 🤞

@nicoverbruggen
Copy link
Owner

@huangdijia Did that fix the issue? If so, let me know so I can confirm this is OK :D

@huangdijia
Copy link
Author

@huangdijia Did that fix the issue? If so, let me know so I can confirm this is OK :D

Not yet

@nicoverbruggen
Copy link
Owner

@huangdijia What issue are you still seeing then? The app doesn't crash anymore, right?

If you're having issues with valet install I recommend you check out this issue.

Unless the app still crashes or something is obviously broken, I would prefer to close the issue.

@nicoverbruggen nicoverbruggen added fixed in upcoming release Fixed in the upcoming release! and removed possibly fixed Possible fixed after troubleshooting but open for additional feedback (or similar reports) labels Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working (correctly). fixed in upcoming release Fixed in the upcoming release!
Projects
None yet
Development

No branches or pull requests

2 participants