skip to Main Content

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

2

Answers


  1. First

    $ brew update
    

    and

    $ brew upgrade php
    
    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search