- Published on : 13 October 2018 at 09:53 UTC
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 :
- the original project on Google Code (last update : 22/07/2013)
- the project on SourceForge (the last available version was published on : 8/01/2016)
- the current project on GitHub that has been very recently updated (the last update is from 2019)
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
- for VirtualBox 6.0.0, you will have to download the "develop" version of phpVirtualBox from the official GitHub, as indicated on this page of the phpVirtualBox project.
- for VirtualBox 6.1.0, you will need to download the "6.1-0" version of the unofficial fork of phpVirtualBox created by cesium147, as indicated on the "Support for Virtualbox 6.1" page of the phpVirtualBox project.
- Installing the web server for phpvirtualbox
- Installing and configuring phpvirtualbox
- Change password for phpvirtualbox
- phpvirtualbox presentation
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
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 :
"%ProgramFiles%\Oracle\VirtualBox\vboxwebsrv.exe" -H 127.0.0.1 >nul
You will get a result like this :
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. IMPORTANT : the password can't be empty, otherwise the connection to vboxwebsrv will be refused.
- $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.
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.