-
Installing
curl -L -O https://github.com/phpbrew/phpbrew/raw/master/phpbrew chmod +x phpbrew sudo mv phpbrew /usr/bin/phpbrew
-
Setup
phpbrew init phpbrew known --update phpbrew update
-
Lots of PHP dependencies
sudo apt-get install libxml2-dev sudo apt-get install libcurl4-openssl-dev pkg-config sudo apt-get install libbz2-dev sudo apt-get install libxml2-dev sudo apt-get install libreadline-dev sudo apt-get install postgresql -y
-
Finally, install a PHP version
phpbrew -d install 5.4 +default
-
Check if the version is correclty installed.
phpbrew list
-
Switch to the version you want
phpbrew switch php-5.4.45 (Or phpbrew switch 5.4.45 in case of Invalid Argument)
-
Check results
php -v
-
PROFIT!!
OBS You can use variants to add extensions, like below, to add PHP-FPM:
phpbrew -d install 5.4 +default +fpm
Thanks, this also appears to be needed now. Or at least it was for me.