Up and Running with PHP 7 — Installation for Testing

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

2. Vagrant box setup

  • Change your directory to the cloned directory: cd php7dev
  • 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 php7dev directory then run vagrant up

4. add host directive

  • sudo nano /etc/hosts
  • Add and modify this line: 192.168.7.7 rename-me.dev

5. Run PHP 7

  • add php7dev/src/index.php file with the following contents:

<?php

echo 'Hello World';


You should now be up and running with php 7.