Laravel - Valet 2.* only returns 'it works!

2019-05-15 22:41发布

问题:

I'm trying to setup Valet to use with my Laravel projects, but ran into the problem mentioned in the title. The current version of Valet I'm running is 2.0.3.

So far this is what I've tried:

  • Reinstalled valet + restart
  • Reinstalled php7.0 --with-fpm
  • Restarted nginx
  • Updated composer global
  • Installed and ran mysql through brew
  • Installed and started dnsmasq
  • Restarted all services + started all services via Brew
  • Parked valet in different folders, but getting the same 'it works!'

I've looked at other people with the same problem, but they seem to run Valet 1.*. The solutions for them does not work for me. I don't get any error messages, and pinging foo.dev work as you would expect.

Really appreciate any feedback which can help me resolve this problem.

回答1:

Check apachectl status. Stop apachectl using sudo apachectl stop. Then run: valet install After run: valet restart



回答2:

Before upgrading to this version you should run the following commands to stop and uninstall the existing Caddy daemon as they have said in the documentation:

valet stop
valet uninstall

and then

valet install
valet restart


回答3:

I did not manage to fix the issue on the computer where the problem originated. However, I did manage to get it running on a clean macOS Sierra install, following the guide provided by the Laravel documentation.

Here are the steps I followed in order:

  1. Installed Homebrew
  2. Followed this guide to install php v7.1
  3. Then followed this guide to both install and setup mysql
  4. Installed Valet via composer
  5. Ran the valet install command
    • This installed both nginx and dnsmasq
  6. Ran the valet park in my workspace folder

I can now run example-project.dev in the browser and it will load the project just as the command php artisan serve.

Note: on the computer where the problem originated, both MAMP and XAMP were installed, but not currently running as I tested valet. There might have been config or installation clashes that made this not work as expected.

Hopefully this will help someone in the same situation.



回答4:

I had a different problem where i stopped nginx and then started it manualy, "it works" now. lol

sudo nginx -s stop

sudo nginx