How to use this box with Vagrant:

Vagrant.configure("2") do |config| = "rasmus/php7dev"
  config.vm.box_version = "0.0.1"
vagrant init rasmus/php7dev \
  --box-version 0.0.1
vagrant up

This version was created almost 3 years ago.

Download and install Virtualbox

Download and install Vagrant

Then from a terminal, do:

$ vagrant box add rasmus/php7dev
$ vagrant init rasmus/php7dev
$ vagrant up
(You can ignore the warning about the guest additions version)
$ vagrant ssh

If everything went well you should now be ssh'ed into your php7dev environment.

However, if you check /sbin/ifconfig you will see that your network interface is a private NAT'ed ip. You can get out from it, but you can't get in. Log back out and edit your ~/Vagrantfile. Most of it is commented out. Find the section that says and add: "public_network", type: "dhcp"

There is also a hostmanager plugin that can help here. Do this:

$ vagrant plugin install vagrant-hostmanager

And these lines to your ~/Vagrantfile:

  config.hostmanager.enabled = true
  config.hostmanager.manage_host = true
  config.hostmanager.include_offline = true
  config.hostmanager.ignore_private_ip = false

Then do:

$ vagrant reload

It will ask you which interface to bridge to. Select your current active network interface and it should just work. Try it from your browser: http://php7dev/

It should show the PHP7 phpinfo() page.

Otherwise, if the host manager didn't do its thing, vagrant ssh back in and check the ip manually and add it to your /etc/hosts file.

This also means you don't need to use vagrant ssh anymore. You can just ssh directly into the machine like any other machine on your network at this point.

Now you can install something. The sites live in /var/www.

For example, to install phpBB:

$ cd /var/www
$ wget
$ unzip
$ sudo chown -R www-data phpBB3

Now create /etc/nginx/conf.d/phpbb.conf with this config:

server {
    listen 80;
    server_name  phpbb;
    root   /var/www/phpBB3;
    index  index.php index.html index.htm;
    access_log /var/log/nginx/phpbb-access.log;
    error_log /var/log/nginx/phpbb-error.log;

    location ~ /(config\.php|common\.php|cache|files|images/avatars/upload|includes|store) {
        deny all;
        return 403;

    location ~* \.(gif|jpe?g|png|css)$ {
        expires   30d;

    include php.conf;

You will need to sudo to do it. It shouldn't ask you for a password, but every password, sudo, root, mysql is set to: vagrant in case you need it.

Then do:

$ sudo service nginx reload

On the machine you are running your web browser, add an entry to your /etc/hosts file with:

192.168.x.x phpbb

Substitute your ip there, of course.

Now you can go to http://phpbb/ and you should be redirected to the phpBB installer.

Before you start, you need to create the database:

$ mysqladmin create phpbb

Now go through the steps. Your Database host is localhost and the user is vagrant, password vagrant. Database name is phpbb. You can leave the port empty. Click through the rest and you should be done. Then remove the install directory to get rid of the annoying warning:

$ sudo rm -rf /var/www/phpBB3/install/

For the most part installing almost anything follows the same pattern. Download the tarball or zip file to /var/www. Extract, make it owned by www-data and find the nginx server config. Usually a quick Google search will turn it up. If it doesn't, something like:

    server {
       listen 80;
       server_name mysite;
       root /var/www/mysite;
       access_log /var/log/nginx/mysite-access.log;
       error_log /var/log/nginx/mysite-error.log;

       index index.php index.html;

       location / {
           try_files $uri $uri/ @rewrite;
        location @rewrite {
            rewrite ^(.*)$ /index.php;

        include php.conf;

Usually does the trick.

Composer is installed (in /usr/local/bin) for the packages that need it. You also have PHP versions 5.3 (with both APC and opcache), PHP 5.4, PHP 5.5, PHP 5.6 and PHP 7 all installed. By default the box comes up with PHP 7 running, but to switch to 5.6 temporarily:

$ sudo service php-fpm stop
$ sudo service php56-fpm start

Similarly, from the command line you can run php56.

For debugging, you have many options. Valgrind is installed and the suppressions file is up to date. I have included a helper script I use called memcheck. Try it:

$ memcheck php -v
==3788== Memcheck, a memory error detector
==3788== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==3788== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==3788== Command: php -v
PHP 7.0.0-dev (cli) (built: Jan 28 2015 15:53:12) (DEBUG)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0-dev, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies
==3788== HEAP SUMMARY:
==3788==     in use at exit: 19,112 bytes in 17 blocks
==3788==   total heap usage: 29,459 allocs, 29,442 frees, 3,033,303 bytes allocated
==3788== LEAK SUMMARY:
==3788==    definitely lost: 0 bytes in 0 blocks
==3788==    indirectly lost: 0 bytes in 0 blocks
==3788==      possibly lost: 0 bytes in 0 blocks
==3788==    still reachable: 0 bytes in 0 blocks
==3788==         suppressed: 19,112 bytes in 17 blocks
==3788== For counts of detected and suppressed errors, rerun with: -v
==3788== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 28 from 6)

Also, sometimes it is easier to track down issues with a single standalone process instead of using php-fpm. You can do this like this:

$ sudo service php-fpm stop
$ sudo php-cgi -b /var/run/php-fpm.sock

The debug build will report memory leaks and you can of course run it under gdb or valgrind as well. See the /usr/local/bin/memcheck script for how to run Valgrind.

To update php7 to the latest, do this:

$ cd php-src
$ git pull -r
$ make distclean
$ ./buildconf -f
$ ./cn
$ make
$ sudo make install
$ sudo service php-fpm restart

And a tiny apt primer:

  • update pkg list: sudo apt-get update
  • search for stuff: apt-cache search stuff
  • install stuff: sudo apt-get install stuff
  • list installed: dpkg -l
  • upgrade installed: apt-get upgrade

If something isn't working or you have suggestions, please let me know.

1 provider for this version.
  • virtualbox Hosted by Vagrant Cloud (1.74 GB)