DEV Community

Cover image for Serving sites with different PHP-version using Laravel-valet

Serving sites with different PHP-version using Laravel-valet

Alexander Dyriavin on February 05, 2021

Before starting doing anything from this article, make sure that you already have installed: Brew (https://brew.sh/) PHP (any version) Laravel-...
Collapse
 
leslieeeee profile image
Leslie

If you are a macOS user, ServBay.dev is worth to try. You don't need to spend some time or couple of days to setup anything. Just download it and you can use it immediately. You can run multiple PHP versions simultaneously and switch between them effortlessly.
Honestly, this tool has greatly simplified my PHP development and is definitely worth trying!

Collapse
 
kontramundo profile image
Heisenberg

Thanks

Collapse
 
ihab_abu_afia profile image
πŸ‡΅πŸ‡Έ Ihab Abou Afia πŸ‡ΈπŸ‡¦ πŸ‡ͺπŸ‡¬ πŸ‡¦πŸ‡ͺ

I did ran:
rm -f ~/.config/valet/valet.sock && valet restart

but the 8.1 site worked while the 7.4 give me an error of Gateway.

and I noticed that I have only 1 socket file which is valet84.sock and no valet74.sock create.

Any thoughts?

Collapse
 
istavros profile image
Stavros Ioannidis • Edited

Well you have to start every php you need to run. For example

brew services start php@8.0
brew services start php@7.4 
Enter fullscreen mode Exit fullscreen mode
Collapse
 
dani821 profile image
Dani821

i have followed all your steps but i'm facing 502 Bad Gateway Error.

Collapse
 
j_m profile image
J M

are there sockets for alternative php versions created???
~/.config/valet/valet**.sock ???

valet72.sock, valet74.sock or so?

Collapse
 
dani821 profile image
Dani821

i managed to solve the issue. Thanks

Collapse
 
dani821 profile image
Dani821

there is no Nginx.config file present in ~/.config/valet/Nginx
Please upadte the article

Collapse
 
dyriavin profile image
Alexander Dyriavin

Hello!

Did you secured your app with valet secure?

Collapse
 
dani821 profile image
Dani821 • Edited

no i skip that step..
do i really need to secure app to get this working??

Thread Thread
 
dyriavin profile image
Alexander Dyriavin

Yes, it would create Nginx configuration for your app

Collapse
 
dani821 profile image
Dani821

Here is the error image.