Nono.MA

Change Valet's PHP version for a specific site

AUGUST 24, 2022

Since Laravel Valet version 3, you can choose the specific PHP version a site should run on without the need to change Valet's global PHP version as in previous releases.

You can, for instance, run all your sites in PHP 8.1 but set specific legacy sites to run in PHP 7.4.

You'd set your global Valet PHP version.

valet use php@8.1

Then set the PHP version for a specific linked site.

# When the current folder matches the name of a linked site
valet isolate php@7.4

# Explicitly specifying a site name
valet isolate php@7.4 --site="my-app"

How to find a site's name

valet links
# +------+------------------+-------------------------+-------------+
# | Site | URL              | Path                    | PHP Version |
# +------+------------------+-------------------------+-------------+
# | gs   | http://gs.test   | /Users/.../gs-folio     | php@8.1     |
# | nono | http://nono.test | /Users/.../nonoma-folio | php@8.1     |
# +------+------------------+-------------------------+-------------+

The name of your site is listed in the Site column.

BlogCodeLaravel