VVV is awesome. For all its very impressive features, there are some things it doesn’t do (yet). One of those is run PHP 5.6, or PHP 7 (or, while we’re at it, older versions like PHP 5.3). PHPBrew makes this a walk in the park. If, that is, you use the right configurations and install the correct dependencies. I had a hard time finding a good step-by-step guide detailing missing dependencies and configuration options needed for PHPBrew. I’ve put one here to save others (and myself in the future) some time. And for those curious, many of these steps are helpful when installing on any Ubuntu dev server, not just VVV or WordPress.
Without further ado:
A Walkthrough for Installing PHPBrew on VVV
1. Install Dependencies
This was one of the most annoying things to discover. Every time I tried to install PHPBrew, it failed with a missing dependency.
On VVV, you can install these dependencies with the following command:
sudo apt-get install libxml2-dev libbz2-dev libmcrypt-dev libxslt-dev
2. Download & Install PHPBrew
Install PHPBrew using their recommended fashion (at least, as of March 2016, when this is written):
curl -L -O https://github.com/phpbrew/phpbrew/raw/master/phpbrew chmod +x phpbrew sudo mv phpbrew /usr/local/bin/phpbrew
And, as Lance Cleveland mentions in the comments, you should also type in:
When this is complete, you can review available versions with
phpbrew known. Here you will see a list of PHP versions, new and old. For example, I spotted the latest available version on phpbrew (again, as of March 2016), and installed it with options that are required for WordPress and VVV’s server configuration (note: cli is not strictly required, but I installed it so I could use WP-CLI):
phpbrew install 5.6.19 +default +fpm +mysql +cli
You can add other options, like +curl, for example.
Then, switch. I received a message which gave me a command that didn’t work, so here is the one that did:
phpbrew switch 5.6.19
Or whichever version you are installing.
3. (Optional) Install extensions
If you’re looking for xdebug, a feature that comes standard on VVV but gets overwritten with a new version of PHP, you can add the extension with:
phpbrew ext install xdebug stable
You can install APC and Memcache similarly, if you need to test it.
If you’re looking for any additional configuration options, there are a good number, as well as some helpful hints. These are not WordPress specific, so rather than try to copy them all, take a look at PHPBrew‘s web page, which has a lot of documentation.
I hope this helps you as much as it would have helped me when beginning my PHPBrew adventure.
For a non-VVV server install, I needed to include these dependencies for Ubuntu as well when I installed PHP 5.3:
sudo apt-get install libreadline-dev libicu-dev