Sierra 10.12.4 (16E144f)
Fresh install valet 2.0.3. Actually I uninstalled valet 1.x and everything else except mariadb and installed 2.0.3. Can't get valet to start php-fpm now. Nginx starts/stops fine.
I can manually start php with _brew services start php71_
_valet stop_ also doesn't affect php
bash-3.2$ valet restart
Valet services have been restarted.
bash-3.2$ ps aux|grep php
scoff 13488 0,0 0,0 2442028 804 s003 S+ 11:41 0:00.00 grep php
bash-3.2$ sudo brew services start php71
==> Successfully started `php71` (label: homebrew.mxcl.php71)
bash-3.2$ ps aux|grep php
scoff 14464 0,0 0,0 2432804 664 s004 S+ 11:49 0:00.00 tail -f php-fpm.log
scoff 25912 0,0 0,0 2450220 808 s003 S+ 12:17 0:00.00 grep php
scoff 25910 0,0 0,0 2479988 648 ?? S 12:17 0:00.00 /usr/local/opt/php71/sbin/php-fpm --fpm-config /usr/local/etc/php/7.1/php-fpm.conf
scoff 25909 0,0 0,0 2479988 656 ?? S 12:17 0:00.00 /usr/local/opt/php71/sbin/php-fpm --fpm-config /usr/local/etc/php/7.1/php-fpm.conf
root 25908 0,0 0,1 2479988 6904 ?? Ss 12:17 0:00.05 /usr/local/opt/php71/sbin/php-fpm --fpm-config /usr/local/etc/php/7.1/php-fpm.conf
There's more. If I run _valet start_ php log is empty (no new lines). If I run _sudo brew services start php71_ first and then _valet start_ I get this
[30-Jan-2017 12:07:27] NOTICE: fpm is running, pid 22662
[30-Jan-2017 12:07:27] NOTICE: ready to handle connections
[30-Jan-2017 12:07:40] NOTICE: Terminating ...
[30-Jan-2017 12:07:40] NOTICE: exiting, bye-bye!
So valet stops PHP just fine but can't start it again.
Other than that everything works as expected I just have to start fpm separately.
Ok here's the deal. I've changed in ~/.composer/vendor/laravel/valet/cli/Valet/Brew.php
from
$this->cli->quietly('sudo brew services restart '.$service);
to
$this->cli->passthru('sudo brew services restart '.$service);
now
$ valet restart
Error: Service `php55` is not started.
Error: Service `php56` is not started.
Error: Service `php70` is not started.
Stopping `php71`... (might take a while)
==> Successfully stopped `php71` (label: homebrew.mxcl.php71)
/usr/local/Cellar/php71/7.1.1_12/homebrew.mxcl.php71.plist: Path had bad ownership/permissions
==> Successfully started `php71` (label: homebrew.mxcl.php71)
Valet services have been restarted.
After that
$ sudo chown root /usr/local/Cellar/php71/7.1.1_12/homebrew.mxcl.php71.plist
now it works but...
if I run _brew services start php71_ from CLI it uses /bin/launchctl load -w /Users/scoff/Library/LaunchAgents/homebrew.mxcl.php71.plist
if I run _sudo brew services start php71_ is runs using /usr/local/Cellar/php71/7.1.1_12/homebrew.mxcl.php71.plist
when valet starts fpm it also uses /usr/local/Cellar/php71/7.1.1_12/homebrew.mxcl.php71.plist
but this time php-fpm.log reads
[30-Jan-2017 17:24:43] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
[30-Jan-2017 17:24:43] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
while sudo brew services start php71 start without these notices.
php works though
I think something is broken but I don't know how to fix it
Also with -vvv added to brew
$ valet start
...
Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.
/bin/launchctl load -w /usr/local/opt/php71/homebrew.mxcl.php71.plist
==> Successfully started `php71` (label: homebrew.mxcl.php71)
Valet services have been started.
I had the same problem, although it was with nginx, I'm assuming it's the along the same lines
I ran the nginx restart command manaually and got the invalid permissions
➜ .valet sudo brew services restart nginx
/usr/local/Cellar/nginx/1.10.2_1/homebrew.mxcl.nginx.plist: Path had bad ownership/permissions
==> Successfully started `nginx` (label: homebrew.mxcl.nginx)
I also had the problem where the valet.sock file wasn't being created when running the "PHPFpm" restart as well. The config was written correctly, but the socket file for phpfpm wasn't.
After running:
sudo chown root /usr/local/Cellar/nginx/1.10.2_1/homebrew.mxcl.nginx.plist
Valet started and stopped correctly, and my sites started working again.
@jhoopes I was hopeless, trying to make valet works from 3 days and following those steps things are working now. thanks man!
I think i resolved it by doing:
$ sudo chown root /usr/local/Cellar/dnsmasq/2.76/homebrew.mxcl.dnsmasq.plist
@jhoopes Thanks, I had the same issue and your solution solved it. However, after rebooting I had to manually restart nginx to get Valet to work again.
To fix this, I uninstalled Valet and then uninstalled nginx using brew:
$ brew uninstall --force nginx
When I reinstalled Valet using $ valet install it automatically installs nginx from brew. This seems to have fixed the issue for me.
I had the same issue, when trying to switch PHP versions. This is what I had to do to make valet to work properly:
Switch to PHP 5.6
brew unlink php56 && sudo brew services stop php56 && brew link php71 && valet restart
Switch to PHP 7.1
brew unlink php71 && sudo brew services stop php71 && brew link php56 && valet restart
Most helpful comment
I had the same problem, although it was with nginx, I'm assuming it's the along the same lines
I ran the nginx restart command manaually and got the invalid permissions
I also had the problem where the valet.sock file wasn't being created when running the "PHPFpm" restart as well. The config was written correctly, but the socket file for phpfpm wasn't.
After running:
Valet started and stopped correctly, and my sites started working again.