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

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

Used terminal commands laravel

Create a new project in laravel: #laravel new your-project-name Another way to create a new project: #composer create-project laravel/laravel your-project-name