You should have BREW installed and then run
brew install php@7.4
If you get problem with linking newly installed PHP and get error like
Could not symlink sbin/php-fpm
/usr/local/sbin is not writable.
next thing to do is this.
The sbin folder is no longer created by default in High Sierra and Mac OSx after it. Here is a nice extract explaining the folders purpose
/bin
This directory contains executable programs which are needed
in single user mode and to bring the system up or repair it.
/sbin
Like /bin, this directory holds commands needed to boot the
system, but which are usually not executed by normal users.
So to solve the problem, simply create the directory with sudo mkdir /usr/local/sbin and then set the correct ownership on it with sudo chown -R `whoami`:admin /usr/local/sbin
After that check that run (can be done without force modifier also)
brew link php@7.4 --force
and then check with php --version if version is correct.
Another issue you might have now with Composer is that there is not enough memory for it as it is newly installed php and hasn't got enough memory by default which is usually 128MB, so tho check this first run
php -r "echo ini_get('memory_limit').PHP_EOL;"
and then to get where to change the value, run
php -i | grep php.ini
after that, change the value to some higher number like 2GB or just put -1 for unlimited and try to run composer again.
Also check your /Users/Marko/.bash_profile (whatever is your username) and see that you don't have some hardcoded PHP paths there that could lead to other versions of PHP.