peace_love
peace_love

Reputation: 6471

How can I downgrade my php version with homebrew for MAMP?

My php version is PHP 7.4.1.

But with MAMP, the highest possible php version I can use is 7.3.8.

So, when I try to open my webpage, I get the error message:

Fatal Error: composer.lock was created for PHP version 7.4 or higher but the current PHP version is 7.3.8.

How can I downgrade my php version to fit to my MAMP version?

I tried:

brew install [email protected]

It was installed, but when I now write php --version, I get the error:

-bash: /usr/local/bin/php: No such file or directory

Upvotes: 0

Views: 2270

Answers (2)

Muhammad Dyas Yaskur
Muhammad Dyas Yaskur

Reputation: 8138

you don't need brew's PHP if you want to use MAMP's PHP.

just use Applications/MAMP/bin/php7.3.8/bin/php --version to use MAMP PHP, if you want to use as default command line, just link it to /usr/bin.

to link it run this to your command line:

export MAMP_PHP=/Applications/MAMP/bin/php/php7.3.8/bin
export PATH="$MAMP_PHP:$PATH"

or

PHP_VERSION=`command ls /Applications/MAMP/bin/php/ | sort -n | tail -1`
export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH

check it out for more detail.

PS: Maybe you should delete your brew php to do it.

Upvotes: 2

Immeyti
Immeyti

Reputation: 545

First

$ brew update

and

$ brew upgrade php

Upvotes: 0

Related Questions