Set up PHP 7 development environment

25 Mar 2016 / by KhanhIceTea

Setup requirements

Install VirtualBox

Install Vagrant

Verify all requirements

Open the terminal and try this command to verify Virtualbox is ready.

$ Virtualbox -h

Open the terminal and try this command to verify Vagrant is ready.

$ vagrant --version

Pull PHP 7 box source code

Clone this repository from Github :

$ git clone

Provision the box

$ cd phpbox
$ vagrant up

Note : First provision will take a long time to build the box (about 30-45 minutes). But next time you run the box, it only takes 2 mins.

Development guideline

SSH to the box

Run this command in phpbox folder

$ vagrant ssh

Point your virtualhosts to Box IP

Your PHPBox IP address is, you can change in Vagrantfile

Open /etc/hosts file in your PC to map virtualhosts IP to PHPBox

$ sudo vi /etc/hosts

Each line in this file will have format (IP HOSTNAME). Eg:

Folder structure

PHPBox Structure

  • conf : Configuration
    • modules.ini : PHP module configuration
    • nginx_default : Nginx default host
    • php-fpm.conf : PHP7-FPM configuration
    • vhosts_apache.conf : Apache virtualhosts (if you use Apache)
    • vhosts_nginx : Nginx virtualhosts
    • www.conf : PHP7-FPM worker configuration
  • scripts : provision scripts
  • www : Web root
    • default : document root of default host
    • test : document root of test host
  • .gitignore : gitignore file
  • Vagrantfile : Vagrantfile of PHPBox

Create a new virtualhost

  • Duplicate a server section in vhosts_nginx or VirtualHost in vhosts_apache.conf
  • Edit the server name and document root
  • Pointing servername to PHPBox IP via hosts file
  • Restart web server sudo service nginx restart or sudo service apache2 restart


Composer, Git, Docker is ready

This box included helpful tools like composer, git, docker, redis-server, htop, vim, screen and zsh.

PHPMyAdmin or Adminer

  • Adminer (default) :
  • PHPMyAdmin :


  • MySQL user : root / passwd
  • Redis : localhost:6379

Installation config

You can open the scripts/provision/ to modify some variables to modify some packages.


Sound good ?