Closed Crinsane closed 3 years ago
And indeed, when I go to my home directory, and then .config/valet I see there is no valet.sock. If I switch back to PHP 7.4, valet.sock shows back up again, but it's always gone when switching to PHP 8.0.
When the valet.sock
isn't getting created, it's typically because the intended PHP version's config is encountering an error, causing PHP-FPM not to start ... which is why there's no valet.sock file.
ls -al ~/Library/LaunchAgents | grep homebrew -rw-r--r-- 1 robgloudemans staff 571 Apr 28 20:01 homebrew.mxcl.nginx.plist ls -al /Library/LaunchDaemons | grep homebrew -rw-r--r-- 1 root admin 571 Apr 29 19:46 homebrew.mxcl.nginx.plist
I see you've got Nginx running both as non-root and root. Valet uses root (sudo).
To fix this conflict, stop the non-root one with brew services stop nginx
.
When the
valet.sock
isn't getting created, it's typically because the intended PHP version's config is encountering an error, causing PHP-FPM not to start ... which is why there's no valet.sock file.
Okay, is there a place where I can find where the configuration is wrong? I didn't change any config, it should be a clean install
I see you've got Nginx running both as non-root and root. Valet uses root (sudo). To fix this conflict, stop the non-root one with
brew services stop nginx
.
Done
I'm also seeing this issue after updating to PHP 8.0.5, including updating Valet and re-running valet install
, also including a full clean reinstall of the latest nignx, php, and valet. From what I'm seeing, the .plist file being generated by brew-services is invalid, with the ProgramArguments
being a single string value instead of the array.
When I manually execute the php-fpm
binary it actually serves things just fine through Valet's configuration, but starting the FPM service from valet start php
or brew services start php
fails to start the process.
When I manually execute the php-fpm binary it actually serves things just fine through Valet's configuration, but starting the FPM service from valet start php or brew services start php fails to start the process.
Same for me
On a non-M1 Mac, today I upgraded Homebrew via brew upgrade
and it upgraded my installed PHP versions to 8.0.5 and 7.4.18.
Using valet use php@7.4
and valet use php@8.0
to switch between versions works correctly.
I've confirmed that PHP is both running and showing correct PHP versions in-app by dumping phpinfo()
and checking between switching PHP versions with valet use x
.
Today's plist
files (/Library/LaunchDaemons/homebrew.mxcl.php@7.4.plist
and /Library/LaunchDaemons/homebrew.mxcl.php.plist
) appear to be correctly built:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>homebrew.mxcl.php@7.4</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/opt/php@7.4/sbin/php-fpm</string>
<string>--nodaemonize</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>WorkingDirectory</key>
<string>/usr/local/var</string>
<key>StandardErrorPath</key>
<string>/usr/local/var/log/php-fpm.log</string>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>homebrew.mxcl.php</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/opt/php/sbin/php-fpm</string>
<string>--nodaemonize</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>/usr/local/var/log/php-fpm.log</string>
<key>WorkingDirectory</key>
<string>/usr/local/var</string>
</dict>
</plist>
Maybe homebrew had a bug for a couple days?
I've just uninstall PHP 8.0, removed the plist file. Reinstalled PHP 8.0 again and run valet use php --force
and now everything seems to be working fine again. 👍
Thanks a lot
Clear description of your problem
PHP 8.0 gives a 502 Bad Gateway error, there is no valet.sock.
Expected behavior
When switching between PHP versions, everything should work correctly, but PHP 8.0 is not working
Current behavior
When I'm running Valet on PHP 7.4, everything is working as expected. When I switch to PHP 8.0 (either using PHP Monitor.app, or using
valet use php
) I get a 502 Bad Gateway error.I've tried to debug what is going on, and using
valet log nginx -f
I see this message:And indeed, when I go to my home directory, and then
.config/valet
I see there is novalet.sock
.If I switch back to PHP 7.4,
valet.sock
shows back up again, but it's always gone when switching to PHP 8.0.I've reinstalled Valet, reinstalled PHP, run
valet install
1000 times, but I'm running out of ideas.Diagnosis
sw_vers
valet --version
cat ~/.config/valet/config.json
cat ~/.composer/composer.json
composer global diagnose
composer global outdated
ls -al /etc/sudoers.d/
brew config
brew services list
brew list --formula --versions | grep -E "(php|nginx|dnsmasq|mariadb|mysql|mailhog|openssl)(@\d\..*)?\s"
brew outdated
brew tap
php -v
which -a php
php --ini
nginx -v
curl --version
php --ri curl
~/.composer/vendor/laravel/valet/bin/ngrok version
ls -al ~/.ngrok2
brew info nginx
brew info php
brew info openssl
openssl version -a
openssl ciphers
sudo nginx -t
which -a php-fpm
/usr/local/opt/php/sbin/php-fpm -v
sudo /usr/local/opt/php/sbin/php-fpm -y /usr/local/etc/php/8.0/php-fpm.conf --test
ls -al ~/Library/LaunchAgents | grep homebrew
ls -al /Library/LaunchAgents | grep homebrew
ls -al /Library/LaunchDaemons | grep homebrew
ls -al /Library/LaunchDaemons | grep "com.laravel.valet."
ls -aln /etc/resolv.conf
cat /etc/resolv.conf
ifconfig lo0
sh -c 'echo "------\n/usr/local/etc/nginx/valet/valet.conf\n---\n"; cat /usr/local/etc/nginx/valet/valet.conf | grep -n "# valet loopback"; echo "\n------\n"'
sh -c 'for file in ~/.config/valet/dnsmasq.d/*; do echo "------\n~/.config/valet/dnsmasq.d/$(basename $file)\n---\n"; cat $file; echo "\n------\n"; done'
sh -c 'for file in ~/.config/valet/nginx/*; do echo "------\n~/.config/valet/nginx/$(basename $file)\n---\n"; cat $file | grep -n "# valet loopback"; echo "\n------\n"; done'