Last week we talked about Laravel Homestead, a prepared local development environment for PHP built on Vagrant by Taylor Otwell, meant to serve as a common starting point for all Laravel (and possibly other PHP) projects. If you’ve missed that post, I encourage you to give it a read and get familiar with Homestead as your next starting environment.
A week before that, we talked about the end of beta for 5.6, and the beginning of the RC program. The PHP core development team encourages people to play around and test with RC editions, and to submit build feedback back to them, so that they may gather some usage statistics and possible build errors to address in the next release. PHP 5.6 RC1 has been released some days ago, and can be downloaded.
In this post, we’ll have a quick look at how we can install it over the regular PHP in Laravel Homestead and report the build feedback back to the QA site.
To prepare, please read the original Homestead article and follow it to the letter until you have a working VM up and running.
Then, SSH into your VM by running
vagrant ssh. Once inside, download the latest source via wget, like so:
Depending on when you read this, the link may be different due to other RCs already being out. Next, unpack the downloaded archive and change the directory to the newly created one.
tar xvfj php-5.6.0RC1.tar.bz2 cd php-5.6.0RC1
To build PHP from source in its most basic form, there’s one dependency we absolutely need. Run the following command:
sudo apt-get install libxml2 libxml2-dev
You might have to run
sudo apt-get update if you get an error regarding the IP address from which Aptitude attempts to fetch libxml2-dev. Then, re-run the above command (see gif below). Next, run:
We need to enable FPM because the Homestead PHP is built as FPM and Nginx consumes it as such. If we want to replace the Homestead-installed PHP with our own, we need to enable-fpm before compiling.
Compilation and testing
To compile PHP from source after running the configure command, we run
make will compile PHP from source and report any errors it encountered. It might take a while depending on your processing power.
After the compilation process is complete, run:
This command will run tests for the compiled PHP, and might take a while depending on your configuration values, and the power of your VM and host machine. All the core functionality of PHP will be tested and once done will be sent to HQ if you so choose – please do, these reports help the core development team pinpoint problems before they occur in production releases. The submission process is iffy and there’s no confirmation dialog when giving your email address, so be careful to write it right the first and only time – see gif below.
Installing the compiled PHP is as simple as running
sudo make install
upon which all the necessary binaries should be copied into their respective folders. There’s one final step you should do before the new PHP is actually activated – restart PHP-FPM. This is done by running:
sudo /etc/init.d/php5-fpm restart
php --version now should yield the following result:
Other ways to help
While the building and installation of RC1 into Homestead was purely “selfish”, as in, we get to use it and play around with it, we can further improve the selflessness of the matter by submitting test reports from other platforms and with other configuration values, too.
For example, take a look at the various configuration values you can change to produce different compiled versions of PHP, then submit test results of those iterations. Try booting up a different OS in a different VM instead of Homestead, and install the RC1 there – they’re looking for test results from various operating systems, from Windows to CentOS and others.
Finally, play around with RC1, test the new features and report bugs you find. Let’s work together and make the next version of PHP the best one yet.
The Principles of Beautiful Web Design, 4th Edition
Docker for Web Developers
Learn PHP in One Day and Learn It Well