Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

angelozehr's avatar

Valet: Ping works but browsers get ERR_CONNECTION_REFUSED

I just set up a new computer and wanted to user valet. I followed the installation instructions. When I ping ping foobar.test the package return as expected, but when I try to visit a project, Chrome returns me a ERR_CONNECTION_REFUSED error message (Firefox and Safari also cannot reach the test site).

I don't see what step I did wrong. Has anyone else encountered this problem?

I added my ~/projects folder with valet park. My ~/.valet/config.json looks like this:

{
    "domain": "test",
    "paths": [
        "/Users/angelozehr/.valet/Sites",
        "/Users/angelozehr/projects"
    ]
}

In my ~/projects folder lies e.g. the subfolder hello-world/. Visiting it via `http://hello-world.test/ fails, pinging it, works:

ping hello-world.test
PING hello-world.test (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.034 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.106 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.103 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.046 ms
--- hello-world.test ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.034/0.072/0.106/0.033 ms

Also the services seem to be up and running. If I run brew services list, I get:

php72   started root       /Library/LaunchDaemons/homebrew.mxcl.php72.plist
nginx   started root       /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
mysql   started angelozehr /Users/angelozehr/Library/LaunchAgents/homebrew.mxcl.mysql.plist
dnsmasq started root       /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist

The only error that I can spot myself is in php-fpm.log where it says:

[08-Feb-2018 14:46:05] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
[08-Feb-2018 14:46:05] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
[08-Feb-2018 14:46:05] ERROR: An another FPM instance seems to already listen on /Users/angelozehr/.valet/valet.sock
[08-Feb-2018 14:46:05] ERROR: FPM initialization failed

When I look at the versions being used, the Terminal returns:

which php
/usr/local/bin/php
which composer
/usr/local/bin/composer
which valet
/usr/local/bin/valet

I already uninstalled composer and valet and reinstalled it.

My brew doctor has some errors of which I don't know how relevant they are:

Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
  /usr/local/lib/libtcl8.6.dylib
  /usr/local/lib/libtk8.6.dylib

Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected header files:
  /usr/local/include/fakemysql.h
  /usr/local/include/fakepq.h
  /usr/local/include/fakesql.h
  /usr/local/include/itcl.h
  /usr/local/include/itcl2TclOO.h
  /usr/local/include/itclDecls.h
  /usr/local/include/itclInt.h
  /usr/local/include/itclIntDecls.h
  /usr/local/include/itclMigrate2TclCore.h
  /usr/local/include/itclTclIntStubsFcn.h
  /usr/local/include/mysqlStubs.h
  /usr/local/include/odbcStubs.h
  /usr/local/include/pqStubs.h
  /usr/local/include/tcl.h
  /usr/local/include/tclDecls.h
  /usr/local/include/tclOO.h
  /usr/local/include/tclOODecls.h
  /usr/local/include/tclPlatDecls.h
  /usr/local/include/tclThread.h
  /usr/local/include/tclTomMath.h
  /usr/local/include/tclTomMathDecls.h
  /usr/local/include/tdbc.h
  /usr/local/include/tdbcDecls.h
  /usr/local/include/tdbcInt.h
  /usr/local/include/tk.h
  /usr/local/include/tkDecls.h
  /usr/local/include/tkPlatDecls.h

Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .pc files:
  /usr/local/lib/pkgconfig/tcl.pc
  /usr/local/lib/pkgconfig/tk.pc

Warning: Unbrewed static libraries were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected static libraries:
  /usr/local/lib/libtclstub8.6.a
  /usr/local/lib/libtkstub8.6.a

As you can see, my domain is not *.dev but *.test so the new settings of chrome regarding https should not be the problem. When I run valet secure hello-world, valet restarts, but the problem stays. (the certificate is correctly created in the ~/.valet/Certificates folder) In the /usr/local/Cellar the packages get listed correctly with me as the user:

drwxr-xr-x  3 angelozehr  admin    96B  8 Feb 14:12 dnsmasq
[…]
drwxr-xr-x  3 angelozehr  admin    96B  8 Feb 11:34 mysql
drwxr-xr-x  3 angelozehr  admin    96B  8 Feb 14:08 nginx
drwxr-xr-x  3 angelozehr  admin    96B  8 Feb 14:06 php72
0 likes
3 replies
bashy's avatar

A ping is not port specific. If there's nothing running on the port (80/443) you will get connection refused or if it's blocked (firewall) you will probably get a timeout.

angelozehr's avatar

I reinstalled my Mac OS High Sierra and started from scratch. Worked out just fine untill I installed R 3.4.3 on the machine. Now the problem reoccurs. When I type valet fetch-share-url in my Terminal I get: Failed to connect to 127.0.0.1 port 4040: Connection refused... after removing R and all the dylib and h and pc and a files I now get a new error in the browser: ERR_CONNECTION_REFUSED

Please or to participate in this conversation.