Change php version in mac

Change php version in mac

First you must have installed brew.

 

Run these commands in your terminal

brew install php@7.0

brew install php@7.1

brew install php@7.2

brew install php@7.3

Add this aliases in ~/.zhrc

phpv() {
    valet stop
    brew unlink php@7.0 php@7.1 php@7.2
    brew link --force --overwrite $1
    brew services start $1
    composer global update
    rm -f ~/.config/valet/valet.sock
    valet install
}

alias php70="phpv php@7.0"
alias php71="phpv php@7.1"
alias php72="phpv php"

Related Articles

Add PATH so the laravel executable can be located by your system

A first problem for me was thatI didn;t know where to add ~/.composer/vendor/bin . I searched on the internet and I

SQLSTATE[HY000] [1045] Access denied for user ‘homestead’@’localhost’ (using password: YES)

When I run the command “php artisan migrate” I get the following error message: [PDOException]  SQLSTATE[HY000] [1045] Access denied for

ext-gd * -> the requested PHP extension gd is missing from your system

Problem 1 – dompdf/dompdf v0.8.0 requires ext-gd * -> the requested PHP extension gd is missing from your system. –