- turn off mac and turn on with cmd+r
- open terminal type
csrutil disable
(and later enable it again) - type
reboot
- open terminal type
sudo mount -uw /
- type
killall Finder
- make a backup of
usr/bin/php
- type
sudo rm -r /usr/bin/php
(Giving terminal full disk access and running sudo won't do the trick) - type
brew install php@7.4
(assuming you installed brew before. Also I had to update Xcode which required 40 GB of free space)
Ref: https://samsonasik.wordpress.com/2019/12/01/install-php-7-4-in-macos-sierra-with-homebrew/