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

dawiyo's avatar

So I'm trying to get the built-in Apache to use PHP 7. I have PHP 7 installed via Homebrew and my $PATH is being called correctly with

which php

But when I do

phpinfo();

with Laravel, it seems Apache is still using PHP 5.5.31. I know this isn't a Valet issue per se, but any help would be appreciated.

theUnforgiven's avatar

Managed to get it sorted from reading Eric Barnes' blog post. just unable to connect to database though.

simondavies's avatar

@lstables have you gone and don these:

Started MariaDb or the DB

Logged into the DB via terminal or sequel pro with the username root and blank password, host 127.0.01

Then set up your user connections details and also a intitial DB as well?

My issue was i had to log in to the db and create my current user for the project and then it connect all ok.

hope this helps if not, post what error codes etc you are getting to help

ChristopherSFSD's avatar

@dawiyo You need to tell apache to use the php7 module ...

LoadModule php7_module /usr/local/opt/php70/libexec/apache2/libphp7.so
simondavies's avatar

@lstables can you access if via an app like sequel pro or via the terminal like mysql -u root -p etc?

theUnforgiven's avatar

@simondavies No I can't

mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2 "No such file or directory")
olimorris's avatar

My error was caused by some bug where by MySQL was saying it couldn't find some .sock file. I basically just kept trying to reinstall MariaDB and eventually when I tried mysql -uroot it worked. Bizarre.

I then logged into SequelPro as per Valet's instructions and added my 'homestead' user and it worked like a charm.

mahfuz05's avatar

i am using a oauth server and i try to login it does not redirect and got hang all server. anyone one facing this issue?

crnkovic's avatar

Is there now a good reason to prefer Homestead over Valet? I find Valet simple and easy to use while Homestead is a pain to set up and use. Not sure why would anyone prefer Homestead over it.

dawiyo's avatar

@jcrnkovic The main difference is the separation of environments. You can model your Homestead box to match your production environment versus Valet using the built-ins on your Mac.

Sometimes you may want to isolate packages to a Homestead environment for testing. For example, let's say you needed the ImageMagick library, but didn't want to have it on your local machine, Homestead would be a better choice.

Another point, albeit more for Vagrant, is having a standardized box matching production for teams.

1 like
ZimrisNepal's avatar

I got an error.

$ valet install
                    
  [DomainException]                
  Unable to determine linked PHP.  
                                   
install
$which php 

returns:

which php
/usr/local/Cellar/php70/7.0.6/bin/php
christopher's avatar

@ZimrisNepal On my end the PHP Version is stored in

/usr/local/bin/php

Did you installed the PHP Version with Homebrew? e.g brew install homebrew/php/php70

1 like
dneykov's avatar

Hello there, I'm having trouble using valet with mysql. When trying to start mysql with mysql.server start I get this

Starting MySQL
. ERROR!

Also when I try to access mysql from terminal get following error:

mysql -u rooo -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2 "No such file or directory")

Will glad if someone can help me. Thanks.

geeks's avatar

Do you found the solution dneykov ? i´m having the same issue.

Thanks

nickkuijpers's avatar

I fixed the issue about the sock by running the following;

brew install mysql
brew services start mysql
Previous

Please or to participate in this conversation.