valet: Fresh installation of Valet not working on CMS backends

Ive been trying several times to get Laravel completely working ()MBP 2018, Mojave 10.14.5). Below are the steps and caveat messages during installation. No errors were reported. If a Valet expert would know where the problem lies, help would be very appreciated.

Homebrew

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
…
 * [new tag]         2.1.6      -> 2.1.6
HEAD is now at 686760d10 Merge pull request #6262 from Homebrew/dependabot/bundler/docs/public_suffix-3.1.1
==> Installation successful!

$ brew update
Already up-to-date.
$ brew -v
Homebrew 2.1.6

PHP

$ brew install php
…
==> Pouring apr-1.7.0.mojave.bottle.tar.gz
==> Caveats
apr is keg-only, which means it was not symlinked into /usr/local,
because Apple's CLT package contains apr.
…
==> Pouring openssl-1.0.2s.mojave.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain.
… 
openssl is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.
…
==> Pouring apr-util-1.6.1_1.mojave.bottle.tar.gz
==> Caveats
apr-util is keg-only, which means it was not symlinked into /usr/local,
because Apple's CLT package contains apr.
…
==> Pouring libidn-1.35.mojave.bottle.tar.gz
==> Caveats
Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/libidn
…
==> Pouring openldap-2.4.47.mojave.bottle.tar.gz
==> Caveats
openldap is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
…
==> Pouring curl-openssl-7.65.1.mojave.bottle.tar.gz
==> Caveats
curl-openssl is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
…
==> Pouring gettext-0.20.1.mojave.bottle.tar.gz
==> Caveats
gettext is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD gettext library & some software gets confused if both are in the library path.…
==> Pouring libffi-3.2.1.mojave.bottle.tar.gz
==> Caveats
libffi is keg-only, which means it was not symlinked into /usr/local,
because some formulae require a newer version of libffi.
…
==> Pouring readline-8.0.0_1.mojave.bottle.tar.gz
==> Caveats
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.
…
==> Pouring sqlite-3.28.0.mojave.bottle.tar.gz
==> Caveats
sqlite is keg-only, which means it was not symlinked into /usr/local,
because macOS provides an older sqlite3.
…
==> Pouring python-3.7.3.mojave.bottle.1.tar.gz
==> /usr/local/Cellar/python/3.7.3/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python/
==> /usr/local/Cellar/python/3.7.3/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python/
==> /usr/local/Cellar/python/3.7.3/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python/
==> Caveats
Python has been installed as
  /usr/local/bin/python3
…
Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /usr/local/opt/python/libexec/bin
…
==> Pouring icu4c-64.2.mojave.bottle.tar.gz
==> Caveats
icu4c is keg-only, which means it was not symlinked into /usr/local,
because macOS provides libicucore.dylib (but nothing else).
…
==> Pouring libpq-11.3.mojave.bottle.tar.gz
==> Caveats
libpq is keg-only, which means it was not symlinked into /usr/local,
because conflicts with postgres formula.
…
==> Pouring php-7.3.6_1.mojave.bottle.tar.gz
==> /usr/local/Cellar/php/7.3.6_1/bin/pear config-set php_ini /usr/local/etc/php/7.3/php.ini system
==> /usr/local/Cellar/php/7.3.6_1/bin/pear config-set php_dir /usr/local/share/pear system
==> /usr/local/Cellar/php/7.3.6_1/bin/pear config-set doc_dir /usr/local/share/pear/doc system
==> /usr/local/Cellar/php/7.3.6_1/bin/pear config-set ext_dir /usr/local/lib/php/pecl/20180731 system
==> /usr/local/Cellar/php/7.3.6_1/bin/pear config-set bin_dir /usr/local/opt/php/bin system
==> /usr/local/Cellar/php/7.3.6_1/bin/pear config-set data_dir /usr/local/share/pear/data system
==> /usr/local/Cellar/php/7.3.6_1/bin/pear config-set cfg_dir /usr/local/share/pear/cfg system
==> /usr/local/Cellar/php/7.3.6_1/bin/pear config-set www_dir /usr/local/share/pear/htdocs system
==> /usr/local/Cellar/php/7.3.6_1/bin/pear config-set man_dir /usr/local/share/man system
==> /usr/local/Cellar/php/7.3.6_1/bin/pear config-set test_dir /usr/local/share/pear/test system
==> /usr/local/Cellar/php/7.3.6_1/bin/pear config-set php_bin /usr/local/opt/php/bin/php system
==> /usr/local/Cellar/php/7.3.6_1/bin/pear update-channels
==> 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.so

==> `brew cleanup` has not been run in 30 days, running now...
Pruned 0 symbolic links and 11 directories from /usr/local
==> Caveats
==> apr
apr is keg-only, which means it was not symlinked into /usr/local,
because Apple's CLT package contains apr.

==> openssl
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
  /usr/local/etc/openssl/certs
openssl is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.

==> apr-util
apr-util is keg-only, which means it was not symlinked into /usr/local,
because Apple's CLT package contains apr.

==> autoconf
Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/autoconf
==> libidn
Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/libidn
==> openldap
openldap is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

==> curl-openssl
curl-openssl is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

==> libtool
In order to prevent conflicts with Apple's own libtool we have prepended a "g"
so, you have instead: glibtool and glibtoolize.
==> gettext
gettext is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD gettext library & some software gets confused if both are in the library path.

==> libffi
libffi is keg-only, which means it was not symlinked into /usr/local,
because some formulae require a newer version of libffi.

==> readline
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only

==> sqlite
sqlite is keg-only, which means it was not symlinked into /usr/local,
because macOS provides an older sqlite3.

==> python
Python has been installed as
  /usr/local/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /usr/local/opt/python/libexec/bin

==> icu4c
icu4c is keg-only, which means it was not symlinked into /usr/local,
because macOS provides libicucore.dylib (but nothing else).

==> libpq
libpq is keg-only, which means it was not symlinked into /usr/local,
because conflicts with postgres formula.

Composer

$ brew install composer
🍺  /usr/local/Cellar/composer/1.8.6: 3 files, 1.8MB, built in 2 seconds

Valet

$ composer global require laravel/valet
…
Package operations: 21 installs, 0 updates, 0 removals
…         
symfony/service-contracts suggests installing symfony/service-implementation
symfony/console suggests installing symfony/event-dispatcher
symfony/console suggests installing symfony/lock
symfony/console suggests installing psr/log (For using the console logger)
symfony/translation suggests installing symfony/config
symfony/translation suggests installing symfony/yaml
illuminate/support suggests installing illuminate/filesystem (Required to use the composer class (5.8.*).)
illuminate/support suggests installing moontoast/math (Required to use ordered UUIDs (^1.1).)
illuminate/support suggests installing ramsey/uuid (Required to use Str::uuid() (^3.7).)
illuminate/support suggests installing vlucas/phpdotenv (Required to use the env helper (^3.3).)
Writing lock file
Generating autoload files

$ export PATH=$PATH:~/.composer/vendor/bin

$ valet install

Stopping nginx...
Installing nginx...
[nginx] is not installed, installing it now via Brew... 🍻
Installing nginx configuration...
Installing nginx directory...
Updating PHP configuration...
Restarting php...
Installing dnsmasq...
[dnsmasq] is not installed, installing it now via Brew... 🍻
Restarting dnsmasq...
Valet is configured to serve for TLD [.test]
Restarting nginx...

Valet installed successfully!

Checking

$ brew services list

Name    Status  User Plist
dnsmasq started root /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
nginx   started root /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
php     started root /Library/LaunchDaemons/homebrew.mxcl.php.plist

$ php -v
PHP 7.3.6 (cli) (built: Jun 17 2019 08:40:34) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.6, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.6, Copyright (c) 1999-2018, by Zend Technologies

$ which php
/usr/local/bin/php

$ which nginx
/usr/local/bin/nginx

$ nginx -v
nginx version: nginx/1.17.1

$ valet -v
Laravel Valet 2.3.3

Valet link & securing a site

Link and certificate created. Frontend of CMS (Statamic) works fine with https. Trying to login into CP gives me

502 Bad Gateway

~/sites/.config/valet/Log/nginx-error.log:

2019/06/29 13:22:44 [error] 10701#0: *3 upstream prematurely closed connection while reading response header from upstream, client: 127.0.0.1, server: mysite.test, request: "GET /cp HTTP/2.0", upstream: "fastcgi://unix:/Users/wg/.config/valet/valet.sock:", host: "mysite.test"

/usr/local/var/log/php-fpm.log:

[29-Jun-2019 13:14:57] NOTICE: fpm is running, pid 8055
[29-Jun-2019 13:14:57] NOTICE: ready to handle connections
[29-Jun-2019 13:22:44] WARNING: [pool www] child 8065 exited on signal 11 (SIGSEGV) after 467.428053 seconds from start
[29-Jun-2019 13:22:44] NOTICE: [pool www] child 10773 started

/usr/local/var/log/nginx/access.log – empty /usr/local/var/log/nginx/error.log – empty

Restarting services and Valet

$ valet stop
Valet services have been stopped.
$ brew services restart --all

/usr/local/var/log/php-fpm.log:

[29-Jun-2019 13:32:30] NOTICE: Terminating ...
[29-Jun-2019 13:32:30] NOTICE: exiting, bye-bye!
[29-Jun-2019 13:32:35] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
[29-Jun-2019 13:32:35] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
[29-Jun-2019 13:32:35] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
[29-Jun-2019 13:32:35] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
[29-Jun-2019 13:32:35] NOTICE: fpm is running, pid 13410
[29-Jun-2019 13:32:35] NOTICE: ready to handle connections

[29-Jun-2019 13:34:31] ERROR: Another FPM instance seems to already listen on /Users/wg/.config/valet/valet.sock
[29-Jun-2019 13:34:31] ERROR: Another FPM instance seems to already listen on /Users/wg/.config/valet/valet.sock
[29-Jun-2019 13:34:31] ERROR: FPM initialization failed
[29-Jun-2019 13:34:31] ERROR: FPM initialization failed

Restarting services with sudo

$ valet stop
Valet services have been stopped.
$ sudo brew services restart --all
Stopping `dnsmasq`... (might take a while)
==> Successfully stopped `dnsmasq` (label: homebrew.mxcl.dnsmasq)
Warning: Taking root:admin ownership of some dnsmasq paths:
  /usr/local/Cellar/dnsmasq/2.80/sbin
  /usr/local/Cellar/dnsmasq/2.80/sbin/dnsmasq
  /usr/local/opt/dnsmasq
  /usr/local/opt/dnsmasq/sbin
  /usr/local/var/homebrew/linked/dnsmasq
This will require manual removal of these paths using `sudo rm` on
brew upgrade/reinstall/uninstall.
==> Successfully started `dnsmasq` (label: homebrew.mxcl.dnsmasq)
Warning: Taking root:admin ownership of some nginx paths:
  /usr/local/Cellar/nginx/1.17.1/bin
  /usr/local/Cellar/nginx/1.17.1/bin/nginx
  /usr/local/opt/nginx
  /usr/local/opt/nginx/bin
  /usr/local/var/homebrew/linked/nginx
This will require manual removal of these paths using `sudo rm` on
brew upgrade/reinstall/uninstall.
==> Successfully started `nginx` (label: homebrew.mxcl.nginx)
Warning: Taking root:admin ownership of some php paths:
  /usr/local/Cellar/php/7.3.6_1/sbin
  /usr/local/Cellar/php/7.3.6_1/sbin/php-fpm
  /usr/local/opt/php
  /usr/local/opt/php/bin
  /usr/local/opt/php/sbin
  /usr/local/var/homebrew/linked/php
This will require manual removal of these paths using `sudo rm` on
brew upgrade/reinstall/uninstall.
==> Successfully started `php` (label: homebrew.mxcl.php)

After serveral reloads, the backend login screen appears and I can log in. When I click on a CP link to get a list of available updates from the CMS server, I get the bad gateway again and that page is not loaded.

[29-Jun-2019 13:41:53] ERROR: Another FPM instance seems to already listen on /Users/wg/.config/valet/valet.sock
[29-Jun-2019 13:41:53] ERROR: Another FPM instance seems to already listen on /Users/wg/.config/valet/valet.sock
[29-Jun-2019 13:41:53] ERROR: FPM initialization failed
[29-Jun-2019 13:41:53] ERROR: FPM initialization failed

This attempt was with Statamic CMS, but I tried with Craft CMS as well – every time a license key or versions are checked, Craft CP gives an error, plugin store can not be reached within admin.

In Laravel Valet on Discord the same or very similar problems are reported for Wordpress. Trying php@7.2 and php@7.1 did not solve the problem, also not starting all over by removing and reinstalling Homebrew and installing only one of those versions.

Thanks for reading this far and for your suggestions 😃

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 4
  • Comments: 23 (17 by maintainers)

Most upvoted comments

@marflow, @drbyte I think, I have found the issue for the 502 errors. The recent version of curl-openssl is throwing “Segmentation fault” error which is causing the 502 Nginx error.

Please follow the links for the fix: https://discourse.brew.sh/t/symfony-4-segmentaion-fault-11/5074/13 https://github.com/Homebrew/homebrew-core/issues/40812