3

First of all I know there are already posts like this on stackoverflow but I have not been abel to find a solution to my particular problem.

I am trying to install laravel/valet on my mac (OS High Sierra) but I keep getting this error:

In Brew.php line 182: Unable to determine linked PHP.

Now I'm using the PHP that came already installed on my mac, I did not install PHP using homebrew, all the solutions I have found seem to deal with php installations via homebrew. eg brew link php71 which did not work for me.

EDIT: I had to install the latest version of PHP (7.2) via homebrew to get it to work, however I've had issues with laravel and PHP 7.2 in the past reason I stick with 7.1 so would like to know if there's a way I can still use 7.1

user3718908x100
  • 7,939
  • 15
  • 64
  • 123

1 Answers1

1

Valet requires Homebrew.

The php version that ships with MacOS is usually outdated and does not receive the updates it deserves.

Instructions to install Valet can be found here: https://laravel.com/docs/master/valet#installation

To summarise:

Valet requires macOS and Homebrew. Before installation, you should make sure that no other programs such as Apache or Nginx are binding to your local machine's port 80.

  • Install or update Homebrew to the latest version using brew update.
  • Install PHP 7.3 using Homebrew via brew install php.
  • Install Composer.
  • Install Valet with Composer via composer global require laravel/valet. Make sure the ~/.composer/vendor/bin directory is in your system's "PATH".
  • Run the valet install command. This will configure and install Valet and DnsMasq, and register Valet's daemon to launch when your system starts.

Once Valet is installed, try pinging any *.test domain on your terminal using a command such as ping foobar.test. If Valet is installed correctly you should see this domain responding on 127.0.0.1.

Valet will automatically start its daemon each time your machine boots. There is no need to run valet start or valet install ever again once the initial Valet installation is complete.

If after completing the above you still find you are having the 'Unable to determine linked PHP' error then this procedure will fix it:

  • brew list|grep php

This will give you output like this:

php
php@5.6
php@7.1
php@7.2
php@7.3
valet-php@5.6
valet-php@7.1
valet-php@7.2
valet-php@7.3

You may only have some of them. For each php version do this:

  • brew unlink {{FILL PHP VERSION FROM ABOVE}}

This will manually unlink any homebrew php versions you have.

Then link the version you want to use:

  • brew link {{FILL YOUR CHOOSEN PHP VERSION HERE}}

Then just restart Valet.

  • valet restart
Dom
  • 2,240
  • 16
  • 22