With the release of PHP 7 just around the corner, a quick start guide seems to be in order. This guide was written with Linux in mind but it should work ok with Mac OS X. If you are on Windows, you should switch to Linux (or maybe Mac) :). Let’s get a testing environment set up.
1. Vagrant box installation
First, let’s install VirtualBox
Next, you need to install Vagrant version > 1.5
Lastly, clone Rasmus Ludorf’s PHP 7 box
git clone https://github.com/rlerdorf/php7dev.git
2. Vagrant box setup
- Change your directory to the cloned directory:
- Add an
src/directory to the repo.
- Add the
src/directory as a synced folder by adding this line
config.vm.synced_folder "src/", "/var/www/default/src"to the repos Vagrantfile just after the config line
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
3. Create the Vagrant instance
- Make sure you are in the
php7devdirectory then run
4. add host directive
sudo nano /etc/hosts
- Add and modify this line:
5. Run PHP 7
php7dev/src/index.phpfile with the following contents:
<?php echo 'Hello World';
You should now be up and running with php 7.