VirtualBox - Manage your VirtualBox virtual machines from a web browser (phpvirtualbox)

Page 1 / 2

Since VirtualBox is an open-source project and VirtualBox offers an API to communicate directly with its virtualization solution, some developers create programs and/or related scripts.
In this tutorial, we will show you how to manage your virtual machines from a web browser using the phpvirtualbox script originally created by Ian Moore, but which was later taken over by Smart Guide.

If you are looking for "phpvirtualbox" on Google, you will find :

In this tutorial, we will use :

  • the latest version available (5.2.0) of phpvirtualbox referenced on the "Releases · phpvirtualbox" page of the GitHub project.
  • version 5.2.8 of VirtualBox available on the official website of VirtualBox
  • a local web server to use this php script
  1. Installing the web server for phpvirtualbox
  2. Installing and configuring phpvirtualbox
  3. Change password for phpvirtualbox
  4. Settings
  5. phpvirtualbox presentation

1. Installing the web server for phpvirtualbox

To install a local web server, refer to our tutorial about WAMP which is an easy solution to install a web server : Installing WAMP 2.2, 2.4 or 2.5 and its add-ons

2. Installing and configuring phpvirtualbox

As you can see on the official phpvirtualbox wiki, phpvirtualbox works through the "vboxwebsrv" process which is provided by default with VirtualBox.

To start this process, there are 2 possibilities.
Nevertheless, to begin, simply open a command prompt (cmd) and use the command below :

Batch

"%ProgramFiles%\Oracle\VirtualBox\vboxwebsrv.exe" -H 127.0.0.1 >nul

You will get a result like this :

Plain Text

Oracle VM VirtualBox web service Version 5.2.8
(C) 2007-2018 Oracle Corporation
All rights reserved.

Then, unzip the "phpvirtualbox-x.x-x" file downloaded from GitHub and unzip this file into a subfolder of the "www" folder (or "c:\wamp\www" in the case of WAMP).
Then, rename the "config.php-example" file to "config.php".

In this file, change these attributes :

  • $username : the username currently running the "vboxwebsrv.exe" process (hence the name of your Windows session)
  • $password : the password associated with the user above
  • $language : the language in which you want to use phpvirtualbox. In our case : fr

Note : the list of languages is available in the "languages" folder of phpvirtualbox.

In order for phpvirtualbox to communicate with the VirtualBox API, you must enable PHP's "php_soap.dll" extension.
To do this, open the "php.ini" file of PHP, and locate the "extension = php_soap.dll" line.

If not, you will see the error : PHP does not have the SOAP extension enabled.

For this change to be taken into account, don't forget to restart your web server (apache).
In the case of WAMP, you will have to restart the "wampapache" service.

3. Change password for phpvirtualbox

By default, login credentials for phpvirtualbox are : admin / admin.

Once logged in, go to : File -> Change Password.

Enter the current password (by default : admin) and enter your new password.

The admin password has been changed.