简体   繁体   中英

Brew not using right php version (CLI)

I always get stuck on upgrading php... I have done:

brew link php@8.1 --force --overwrite

If I run it again I get

Warning: Already linked: /opt/homebrew/Cellar/php/8.1.9

When I run

valet use php@8.1 --force

and then

valet use php@8.1

I get

Valet is already using version: php@8.1

But when I run

php -v

I get

PHP 8.0.22

I have also done

valet restart

and restarted my computer.

Previously in my zshrc I had:

export PATH="/opt/homebrew/opt/php@8.0/bin:$PATH"
export PATH="/opt/homebrew/opt/php@8.0/sbin:$PATH"

I have commented these out and added:

export PATH="/opt/homebrew/sbin:$PATH"

and then

brew services restart php && valet restart

If I then run

brew doctor

I still get:

Warning: Homebrew's "sbin" was not found in your PATH but you have installed
formulae that put executables in /opt/homebrew/sbin.
Consider setting your PATH for example like so:
  echo 'export PATH="/opt/homebrew/sbin:$PATH"' >> ~/.zshrc

The issue was that you have to restart the terminal before the new config changes take effect...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM