Managing a Headless VirtualBox Installation with phpvirtualbox (Ubuntu 16.04 LTS)

This tutorial exists for these OS versions

On this page

  1. 1 Preliminary Note
  2. 2 Installing phpVirtualBox

phpvirtualbox is a web-based VirtualBox front-end written in PHP that allows you to access and control remote VirtualBox instances. It tries to resemble the VirtualBox GUI as much as possible to make work with it as easy as possible. It is a nice replacement for the VirtualBox GUI if you run VirtualBox in headless servers (like in the tutorial VBoxHeadless - Running Virtual Machines with VirtualBox 5.1 on a headless Ubuntu 16.04 LTS Server). This tutorial explains how to install phpVirtualBox on an Ubuntu 16.04 server to manage a locally installed, headless VirtualBox.

1 Preliminary Note

I'm assuming that a headless VirtualBox is already installed on the local Ubuntu 16.04 server, e.g. as described in the tutorial VBoxHeadless - Running Virtual Machines with VirtualBox 5.1 on a headless Ubuntu 16.04 LTS Server.

I'm running all the steps in this tutorial with root privileges, so make sure you're logged in as root:

sudo su


2 Installing phpVirtualBox

First, create a system user called vbox and add it to the vboxusers group:

useradd -m vbox -G vboxusers

Create a password for the vbox user:

passwd vbox

Create the file /etc/default/virtualbox and put the line VBOXWEB_USER=vbox in it (so that the VirtualBox SOAP API which is called vboxwebsrv runs as the user vbox):

nano /etc/default/virtualbox


Next create the system startup links for vboxwebsrv and start it:

systemctl enable vboxweb-service
systemctl start vboxweb-service

We need a web server with PHP support to serve phpVirtualBox - I'm using Apache2 here. Install Apache and PHP as follows:

apt-get -y install apache2 libapache2-mod-php7.0 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libapr1 php7.0-common php7.0-mysql php7.0-soap php-pear wget

Restart Apache:

systemctl restart apache2.service

I want to serve phpVirtualBox from Apache's default virtual host with the document root /var/www/html (I will install it in /var/www/html/phpvirtualbox) - if you have a different document root, you must adjust the following steps:

cd /var/www/html


Unzip phpVirtualBox and rename the phpvirtualbox-5.0-5 to phpvirtualbox for ease of use:

mv phpvirtualbox-5.0-5 phpvirtualbox

Next go to the /var/www/phpvirtualbox/ directory...

cd /var/www/html/phpvirtualbox/

... and create the file config.php by copying it from config.php-example:

cp config.php-example config.php

Open config.php and fill in the password you created earlier for the vbox system user:

nano config.php

/* Username / Password for system user that runs VirtualBox */
var $username = 'vbox';
var $password = 'secret';

That's it already - you can now open a browser and access phpVirtualBox as follows:

or By IP:

Share this page:

Suggested articles

11 Comment(s)

Add comment


From: RsW

You need to adjust your link to phpvirtualbox to sourceforge

From: Michal

It is not working on ubuntu 16.04...

Always shows 'Invalid username or password' while I write correct one.


root@ubuntuSvr:/var/lib/php# su vbox -c "vboxwebsrv"Oracle VM VirtualBox web service Version 5.1.4(C) 2007-2016 Oracle CorporationAll rights reserved.VirtualBox web service 5.1.4 r110228 linux.amd64 (Aug 16 2016 18:39:19) release log00:00:00.000106 main     Log opened 2016-08-18T19:56:23.307362000Z00:00:00.000108 main     Build Type: release00:00:00.000111 main     OS Product: Linux00:00:00.000111 main     OS Release: 4.4.0-34-generic00:00:00.000112 main     OS Version: #53-Ubuntu SMP Wed Jul 27 16:06:39 UTC 201600:00:00.000139 main     DMI Product Name: D2831-S100:00:00.000147 main     DMI Product Version:00:00:00.000198 main     Host RAM: 3882MB total, 3484MB available00:00:00.000201 main     Executable: /usr/lib/virtualbox/vboxwebsrv00:00:00.000201 main     Process ID: 685400:00:00.000202 main     Package type: LINUX_64BITS_UBUNTU_16_0400:00:00.001694 main     IPC socket path: /tmp/.vbox-vbox-ipc/ipcd00:00:00.007189 SQPmp    Socket connection successful: host = default (localhost), port = 18083, master socket = 900:00:05.007311 Watchdog Statistics: 0 websessions, 0 references00:00:08.341725 SQPmp    Request 1 on socket 10 queued for processing (1 items on Q)00:00:08.341764 SQW01    New SOAP thread started00:00:08.341796 SQW01    Processing connection from IP= socket=10 (0 out of 1 threads idle)00:00:08.342656 SQW01    External authentication library is 'VBoxAuth'00:00:08.382593 SQW01    Access for user 'vbox' granted00:07:03.775464 SQPmp    Request 2 on socket 10 queued for processing (1 items on Q)00:07:03.775576 SQW01    Processing connection from IP= socket=10 (0 out of 1 threads idle)00:07:03.818069 SQW01    Access for user 'vbox' granted00:07:32.989516 SQPmp    Request 3 on socket 10 queued for processing (1 items on Q)00:07:32.989610 SQW01    Processing connection from IP= socket=10 (0 out of 1 threads idle)00:07:33.031199 SQW01    Access for user 'vbox' granted00:12:31.690524 SQPmp    Request 4 on socket 10 queued for processing (1 items on Q)00:12:31.690615 SQW01    Processing connection from IP= socket=10 (0 out of 1 threads idle)00:12:31.734332 SQW01    Access for user 'vbox' granted

Is it a problem with: /var/lib/php/session? The session folder doesn't exist but there is 'sessions' folder.

What is the problem?

From: PairedPrototype

Just thought I'd say, I had the error at the top and starting/restarting the service didn't help, what did help was rebooting my server since the kernel had been changed.


Might help others! :)

From: Ken Hawkins

OK,  serious issues with this recipe:

1 - phpvirtualbox 5.0 NOT compatible with Virtualbox 5.1.0

2 - Virtualbox website states Virtualbox 5.0 (to try to fix PROBLEM #1) not available for 16.04

3 - no phpvirtualbox 5.1 yet available

4 - Many postings about how vbox user account can be problematic and how localhost vs can trip you up. I had to change config.php to the static IP of the host box to get past an error:

Could not connect to host (

Do the authors of these tutorials actually TEST the recipe? Or do they just recycle by cut/paste new version numbers over old?



From: till

This has been tested of course and PHPVirtualBox work works well with Virtualbox 5.1, that's why we described it in the above tutorial. When you install a Virtualbox 5.0 instead of the 5.1 from this tutorial then your setup will not work off and your setup is not the one described here. If you would have read the second page of the tutorial then you would have noticed that I wrote that PHPVirtualBox throws a message that it does not support VirtualBox 5.1 yet but it nevertheless works as VirtualBox 5.1 is downwards compatible with 5.0, so only new functions introduced in 5.1 are not availablethrough phpvirtualbox.

From: Federico Carrara

I confirm some issues with phpvirtualbox 5.0 and Virtualbox 5.1.0. 


Here what happened to me:


I followed this tutorial and everything worked fine. 

When all was working, if I try command "netstat -tulpn | grep 18083" I (correctly) get:

tcp        0      0*               LISTEN      3537/vboxwebsrv 

that is: vboxwebsrv is listening on port 18083


After some weeks, for some reasons, (only) vboxwebsrv crashed (while VMs continued to work correctly), and phpvirtualbox started showing "Error Fetching http headers (".

I tried "sudo systemctl restart vboxweb-service" but no effect.

I tried "sudo vboxwebsrv -b --host -p 18083" and no effect, but console showed error: "#### SOAP FAULT: Address already in use [SOAP-ENV:Server]".

So I tried again "netstat -tulpn | grep 18083" and, strangely, output was:

tcp        0      0*               LISTEN      1001       22406       23386/VBoxSVC   

It seems that after vboxwebsrv crash, the port 18083 start being used by VBoxSVC, and no more by vboxwebsrv.

Googled and tryed everything to solve the problem without restarting host server, but no success. The only thing that helped was to acpishutdown all VMs and restart the host. After server reboot, phpvirtualbox and everything restarted correctly.

I think is important to be able to recover a vboxwebsrv crash WITHOUT host server reboot.

Anyone had similar experience?




From: Henry Ho

Just add some commands at the beginning of the paper, and everything is OK!

The commands shows below:

sudo vi /etc/apt/sources.list

deb xenial contrib

cd /tmp

wget -q -O- | sudo apt-key add -

wget -q -O- | sudo apt-key add -

sudo aptitude update

sudo aptitude install -y dkms

sudo aptitude install -y virtualbox-5.0

From: danceswithcats

Hi. In stage 2 "Installing phpVirtualBox", the apache and PHP download gave me this error:

Unable to locate package libaprl

Unable to locate package libaprutill

Unable to locate package libaprutill-dbd-sqlite3

Unable to locate package libaprutill-ldap

Unable to locate package libaprl

What do I do?

From: Kuerio

after the problems of 'Invalid username or password', i added the "var $noAuth = true;" in config.php, then it worked.

From: Coen

works good

i added this to nano /etc/default/virtualbox



and i did not use vbox as my user but my default username and password

the first login in phpvirtualbox = admin admin then there in the file -> preferences settings i added my default username and password as admistrator

the error that phpvirtual does not work with the diferent version of virtualbox does not matter

From: Coen

don't forget to allow http in you ufw iptablets 

sudo ufw allow http