I don't remember exactly how my system got into this state, but for some reason Valet doesn't seem to recognise / be able to start my PHP-FPM.
When I visit a Valet site in my browser, it displays "Safari Can't Connect to the Server" (or ERR_CONNECTION_REFUSED in Chrome).
When I run valet restart, it doesn't change anything about the php brew service (per brew services list output). There also isn't a php-fpm service running. When I run brew services start php (or sudo brew services start php) manually, a php-fpm process gets started, but Valet doesn't seem to pick it up, I still cannot visit any of my sites.
sw_vers
ProductName: macOS ProductVersion: 11.0.1 BuildVersion: 20B29
valet --version
Laravel Valet 2.13.2
cat ~/.config/valet/config.json
{
"tld": "test",
"paths": [
"/Users/amzonnenberg/Code"
]
}
cat ~/.composer/composer.json
{
"require": {
"squizlabs/php_codesniffer": "^3.5",
"laravel/valet": "^2.9",
"psy/psysh": "^0.10.2",
"laravel/installer": "^4.0"
}
}
composer global diagnose
Changed current directory to /Users/amzonnenberg/.composer Checking composer.json: WARNING No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license. Checking platform settings: OK Checking git settings: OK Checking http connectivity to packagist: OK Checking https connectivity to packagist: OK Checking github.com oauth access: OK Checking disk free space: OK Checking pubkeys: Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0 87719BA6 8F3BB723 4E5D42D0 84A14642 Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B 0C708369 153E328C AD90147D AFE50952 OK Checking composer version: OK Composer version: 2.0.7 PHP version: 7.4.13 PHP binary path: /usr/local/Cellar/php/7.4.13/bin/php OpenSSL version: OpenSSL 1.1.1h 22 Sep 2020 cURL version: 7.73.0 libz 1.2.11 ssl OpenSSL/1.1.1h zip extension: OK
composer global outdated
Changed current directory to /Users/amzonnenberg/.composer
ls -al /etc/sudoers.d/
total 0 drwxr-xr-x 2 root wheel 64 Jan 1 2020 . drwxr-xr-x 87 root wheel 2784 Nov 26 16:57 ..
brew config
HOMEBREW_VERSION: 2.5.11-257-g86631b4 ORIGIN: https://github.com/Homebrew/brew HEAD: 86631b4fef1b160477ed31a4e9667c8baeecb420 Last commit: 86 minutes ago Core tap ORIGIN: https://github.com/Homebrew/homebrew-core Core tap HEAD: 62d2825bfe766bae03a958d2dcb6a229d032f90e Core tap last commit: 7 minutes ago Core tap branch: master HOMEBREW_PREFIX: /usr/local HOMEBREW_CASK_OPTS: [] HOMEBREW_EDITOR: nvim HOMEBREW_MAKE_JOBS: 4 Homebrew Ruby: 2.6.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby CPU: quad-core 64-bit kabylake Clang: 12.0 build 1200 Git: 2.24.3 => /Library/Developer/CommandLineTools/usr/bin/git Curl: 7.64.1 => /usr/bin/curl macOS: 11.0.1-x86_64 CLT: 12.0.32.2 Xcode: N/A
brew services list
Name Status User Plist dnsmasq started root /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist [email protected] started amzonnenberg /Users/amzonnenberg/Library/LaunchAgents/[email protected] nginx stopped php stopped postgresql started amzonnenberg /Users/amzonnenberg/Library/LaunchAgents/homebrew.mxcl.postgresql.plist redis started amzonnenberg /Users/amzonnenberg/Library/LaunchAgents/homebrew.mxcl.redis.plist unbound stopped
brew list --versions | grep -E "(php|nginx|dnsmasq|mariadb|mysql|mailhog|openssl)(@\d..*)?\s"
curl-openssl 7.73.0 dnsmasq 2.82 [email protected] 5.7.32 nginx 1.19.5 [email protected] 1.1.1h php 7.4.13
brew outdated
php -v
PHP 7.4.13 (cli) (built: Nov 26 2020 05:06:10) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.13, Copyright (c), by Zend Technologies
which -a php
/usr/local/bin/php /usr/bin/php
php --ini
Configuration File (php.ini) Path: /usr/local/etc/php/7.4 Loaded Configuration File: /usr/local/etc/php/7.4/php.ini Scan for additional .ini files in: /usr/local/etc/php/7.4/conf.d Additional .ini files parsed: /usr/local/etc/php/7.4/conf.d/ext-opcache.ini, /usr/local/etc/php/7.4/conf.d/php-memory-limits.ini
nginx -v
nginx version: nginx/1.19.5
curl --version
curl 7.64.1 (x86_64-apple-darwin20.0) libcurl/7.64.1 (SecureTransport) LibreSSL/2.8.3 zlib/1.2.11 nghttp2/1.41.0 Release-Date: 2019-03-27 Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp Features: AsynchDNS GSS-API HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz MultiSSL NTLM NTLM_WB SPNEGO SSL UnixSockets
php --ri curl
curl cURL support => enabled cURL Information => 7.73.0 Age => 7 Features AsynchDNS => Yes CharConv => No Debug => No GSS-Negotiate => No IDN => Yes IPv6 => Yes krb4 => No Largefile => Yes libz => Yes NTLM => Yes NTLMWB => Yes SPNEGO => Yes SSL => Yes SSPI => No TLS-SRP => Yes HTTP2 => Yes GSSAPI => Yes KERBEROS5 => Yes UNIX_SOCKETS => Yes PSL => No HTTPS_PROXY => Yes MULTI_SSL => No BROTLI => Yes Protocols => dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, mqtt, pop3, pop3s, rtmp, rtsp, scp, sftp, smb, smbs, smtp, smtps, telnet, tftp Host => x86_64-apple-darwin20.1.0 SSL Version => OpenSSL/1.1.1h ZLib Version => 1.2.11 libSSH Version => libssh2/1.9.0 Directive => Local Value => Master Value curl.cainfo => no value => no value
~/.composer/vendor/laravel/valet/bin/ngrok version
ngrok version 2.3.35
ls -al ~/.ngrok2
ls: /Users/amzonnenberg/.ngrok2: No such file or directory
brew info nginx
nginx: stable 1.19.5 (bottled), HEAD HTTP(S) server and reverse proxy, and IMAP/POP3 proxy server https://nginx.org/ /usr/local/Cellar/nginx/1.19.5 (25 files, 2.2MB) * Poured from bottle on 2020-11-26 at 19:08:22 From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/nginx.rb License: BSD-2-Clause ==> Dependencies Required: [email protected], pcre ==> Options --HEAD Install HEAD version ==> Caveats Docroot is: /usr/local/var/www The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that nginx can run without sudo. nginx will load all files in /usr/local/etc/nginx/servers/. To have launchd start nginx now and restart at login: brew services start nginx Or, if you don't want/need a background service you can just run: nginx ==> Analytics install: 47,384 (30 days), 117,943 (90 days), 441,615 (365 days) install-on-request: 46,625 (30 days), 116,075 (90 days), 429,682 (365 days) build-error: 0 (30 days)
brew info php
php: stable 7.4.13 (bottled), HEAD General-purpose scripting language https://www.php.net/ /usr/local/Cellar/php/7.4.13 (497 files, 72.3MB) * Poured from bottle on 2020-11-26 at 19:08:52 From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/php.rb License: PHP-3.01 ==> Dependencies Build: httpd, pkg-config Required: apr, apr-util, argon2, aspell, autoconf, curl-openssl, freetds, gd, gettext, glib, gmp, icu4c, krb5, libffi, libpq, libsodium, libzip, oniguruma, openldap, [email protected], pcre2, sqlite, tidy-html5, unixodbc ==> Options --HEAD Install HEAD version ==> Caveats To enable PHP in Apache add the following to httpd.conf and restart Apache: LoadModule php7_module /usr/local/opt/php/lib/httpd/modules/libphp7.soSetHandler application/x-httpd-php Finally, check DirectoryIndex includes index.php DirectoryIndex index.php index.html The php.ini and php-fpm.ini file can be found in: /usr/local/etc/php/7.4/ To have launchd start php now and restart at login: brew services start php Or, if you don't want/need a background service you can just run: php-fpm ==> Analytics install: 56,310 (30 days), 157,610 (90 days), 585,479 (365 days) install-on-request: 55,326 (30 days), 154,607 (90 days), 558,663 (365 days) build-error: 0 (30 days)
brew info openssl
[email protected]: stable 1.1.1h (bottled) [keg-only] Cryptography and SSL/TLS Toolkit https://openssl.org/ /usr/local/Cellar/[email protected]/1.1.1h (8,067 files, 18.5MB) Poured from bottle on 2020-11-18 at 13:36:26 From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/[email protected] License: OpenSSL ==> Caveats A CA file has been bootstrapped using certificates from the system keychain. To add additional certificates, place .pem files in /usr/local/etc/[email protected]/certs and run /usr/local/opt/[email protected]/bin/c_rehash [email protected] is keg-only, which means it was not symlinked into /usr/local, because macOS provides LibreSSL. If you need to have [email protected] first in your PATH run: echo 'set -g fish_user_paths "/usr/local/opt/[email protected]/bin" $fish_user_paths' >> ~/.config/fish/config.fish For compilers to find [email protected] you may need to set: set -gx LDFLAGS "-L/usr/local/opt/[email protected]/lib" set -gx CPPFLAGS "-I/usr/local/opt/[email protected]/include" For pkg-config to find [email protected] you may need to set: set -gx PKG_CONFIG_PATH "/usr/local/opt/[email protected]/lib/pkgconfig" ==> Analytics install: 752,308 (30 days), 1,987,758 (90 days), 7,400,928 (365 days) install-on-request: 116,822 (30 days), 293,495 (90 days), 1,056,661 (365 days) build-error: 0 (30 days)
openssl version -a
LibreSSL 2.8.3 built on: date not available platform: information not available options: bn(64,64) rc4(16x,int) des(idx,cisc,16,int) blowfish(idx) compiler: information not available OPENSSLDIR: "/private/etc/ssl"
openssl ciphers
ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-CHACHA20-POLY1305:GOST2012256-GOST89-GOST89:DHE-RSA-CAMELLIA256-SHA256:DHE-RSA-CAMELLIA256-SHA:GOST2001-GOST89-GOST89:AES256-GCM-SHA384:AES256-SHA256:AES256-SHA:CAMELLIA256-SHA256:CAMELLIA256-SHA:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-CAMELLIA128-SHA256:DHE-RSA-CAMELLIA128-SHA:AES128-GCM-SHA256:AES128-SHA256:AES128-SHA:CAMELLIA128-SHA256:CAMELLIA128-SHA:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:RC4-MD5:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:DES-CBC3-SHA
sudo nginx -t
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful
which -a php-fpm
/usr/sbin/php-fpm
/usr/local/opt/php/sbin/php-fpm -v
PHP 7.4.13 (fpm-fcgi) (built: Nov 26 2020 05:06:24)
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.13, Copyright (c), by Zend Technologies
sudo /usr/local/opt/php/sbin/php-fpm -y /usr/local/etc/php/7.4/php-fpm.conf --test
[26-Nov-2020 19:22:34] NOTICE: configuration file /usr/local/etc/php/7.4/php-fpm.conf test is successful
ls -al ~/Library/LaunchAgents | grep homebrew
-rw-r--r-- 1 amzonnenberg staff 551 Jul 24 12:08 [email protected] -rw-r--r-- 1 amzonnenberg staff 719 Nov 24 12:35 homebrew.mxcl.postgresql.plist -rw-r--r-- 1 amzonnenberg staff 823 Nov 18 14:49 homebrew.mxcl.redis.plist
ls -al /Library/LaunchAgents | grep homebrew
ls -al /Library/LaunchDaemons | grep homebrew
-rw-r--r-- 1 root admin 657 Nov 18 14:46 homebrew.mxcl.dnsmasq.plist
Do you have a /usr/local/etc/php/7.4/php-fpm.d/valet-fpm.conf file?
I think I'd start with the following to remove PHP 7.4 and its config, and have Valet reinstall+reconfigure things:
rm -rf `/usr/local/etc/php/7.4`
#this will probably say @7.4 isn't installed; that's fine
brew remove [email protected]
brew remove php
# if "brew remove" gives any errors about needing to use sudo to remove some directories, do that and continue
valet install
I did have a /usr/local/etc/php/7.4/php-fpm.d/valet-fpm.conf file. I followed your steps to remove PHP. It did recognise [email protected] for removal.
After running valet install, the problem is still unresolved. For some reason, the output mentions that nginx and dnsmasq weren't installed, while they actually were installed...
$ valet install
Stopping nginx...
Installing nginx...
[nginx] is not installed, installing it now via Brew... 馃嵒
Installing nginx configuration...
Installing nginx directory...
Installing php...
[php] is not installed, installing it now via Brew... 馃嵒
Updating PHP configuration...
Installing dnsmasq...
[dnsmasq] is not installed, installing it now via Brew... 馃嵒
Updating Dnsmasq configuration...
Valet is configured to serve for TLD [.test]
Valet installed successfully!
When I run valet install again, I get the exact same output.
Would you like to run brew list | grep php?
If my predictions are correct, it may have something to do with #1003.
If you check the restartService method of Brew class, it is checked with the installed method, which is solved in #1003.
I get the same message as you described in #1003:
$ brew list | grep php
Error: Calling `brew list` to only list formulae is disabled! Use `brew list --formula` instead.
i have the same issue since this morning ... wondering if there is not a problem since I did brew upgrade and php8.0 creates some confusion with valet (even after a valet use [email protected])
@adriaanzon Try brew list --formula | grep php instead
Also, what do you see with :
brew services list
Manually applying the changes in #1003 seems to resolve it for me.
Released in v2.13.3. Please feel free to re-open if that didn't fix. Thanks!
Most helpful comment
Would you like to run
brew list | grep php?If my predictions are correct, it may have something to do with #1003.
https://github.com/laravel/valet/blob/21f0549bd54e4ff4bf186ae8ff504140d38a213b/cli/Valet/Brew.php#L166
https://github.com/laravel/valet/blob/21f0549bd54e4ff4bf186ae8ff504140d38a213b/cli/Valet/Brew.php#L49
If you check the restartService method of Brew class, it is checked with the installed method, which is solved in #1003.