Instalar PHP en su última versión estable
$ brew install php
$ php -v
PHP 8.1.2 (cli) (built: Jan 21 2022 04:47:46) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies
Instalar PHP 7.4
$ brew install [email protected]
Ahora se tiene las dos versiones de PHP instaladas. Para cambiar entre una y otra se debe usar el comando link y unlink de brew.
$ brew unlink [email protected]
Unlinking /usr/local/Cellar/php/8.1.2... 24 symlinks removed.
$ brew link [email protected]
Linking /usr/local/Cellar/[email protected]/7.4.27... 25 symlinks created.
$ php -v
PHP 7.4.27 (cli) (built: Dec 16 2021 18:14:46) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.27, Copyright (c), by Zend Technologies