Use Homebrew/core
instead of Homebrew/php
brew install php@5.6 --with-pear
brew install php@7.0 --with-pear
brew install php@7.1 --with-pear
brew install php@7.2 --with-pear
Also, you may have the need to tweak configuration settings of PHP to your needs. A common thing to change is the memory setting, or the date.timezone
configuration. The php.ini
files for each version of PHP are located in the following directories:
/usr/local/etc/php/5.6/php.ini
/usr/local/etc/php/7.0/php.ini
/usr/local/etc/php/7.1/php.ini
/usr/local/etc/php/7.2/php.ini
To switch to PHP 5.6
brew unlink php@7.2 && brew link --force --overwrite php@5.6
To check which php.ini
is in used
php --ini
or
php -i | grep 'Configuration File'
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /etc/php.ini