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

jknight's avatar

Trouble with valet install

I have followed the installation steps for valet found here: https://laravel.com/docs/5.3/valet#installation I am able to run valet install but get the following message

valet install

Warning: file_get_contents(/usr/local/etc/php/7.0/php-fpm.d/www.conf): failed to open stream: No such file or directory in /Users/jknight/.composer/vendor/laravel/valet/cli/Valet/Filesystem.php on line 112

Warning: file_put_contents(/usr/local/etc/php/7.0/php-fpm.d/www.conf): failed to open stream: No such file or directory in /Users/jknight/.composer/vendor/laravel/valet/cli/Valet/Filesystem.php on line 125

Valet installed successfully!

I can then successfully ping a .dev and get 127.0.0.1 as expected, but when I visit one of my dev applications in a browser i just get a 502 Bad Gateway.

Does anyone have any Ideas on how to resolve this issue?

0 likes
5 replies
dgrauers's avatar

Hi everyone,

I had same problem but, after a lot googling + try and error, finally I solved!

In my case I've installed macos sierra from scratch and (after installed brew, composer, php7 and valet) I got an 502 Bad Gateway error because php-fpm.conf were missing. This is what I did, just in case can help someone:

  • Installed XCode 8, open it, accept terms and close it.
  • Installed "Command Line Tools" from terminal:
$ xcode-select --install
  • Then tried this "magic" in terminal (I think the change in the symlinks is the key point) :
$ brew link apr-util --force
$ brew link apr --force
$ which apu-1-config
/usr/local/bin/apu-1-config
$ which apr-1-config
/usr/local/bin/apr-1-config
$ sudo mkdir -p /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/ 
$ sudo ln -s /usr/local/bin/apu-1-config /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/
$ sudo ln -s /usr/local/bin/apr-1-config /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.12.xctoolchain/usr/local/bin/
  • And finally (php installation took a while for me):
$ brew uninstall php70
$ brew install php70 --build-from-source
$ valet install

If everything goes right the warnings missing php-fpm config will not appear!

The "solution" is a mix between of Adam Wathan's Troubleshooting Valet on Sierra and this stackoverflow answer

3 likes
JasonSuave's avatar

I am still on El Capitan and was having the exact same issue.

All that was needed in my case was running the last step in dgrauers' solution:

$ brew uninstall php70
$ brew install php70 --build-from-source
$ valet install
3 likes
jknight's avatar

Does anyone know if you can successfully run both Homestead/Vagrant and Valet or can it only be one or the other?

1 like
afik162534's avatar

@jknight Yes you can, I have it on my machine, I work with homestead for big projects when I need Cron Jobs and caching services, and I use valet for quuick small projects.

1 like

Please or to participate in this conversation.