Difference between revisions of "PhpVirtualBox"

From ArchWiki
Jump to navigation Jump to search
(Web service)
Line 26: Line 26:
{{Note|This user must be in group '''vboxusers'''!}}
{{Note|This user must be in group '''vboxusers'''!}}
If Oracle-distributed binary edition of VirtualBox, available with AUR package {{AUR|virtualbox_bin}} there is already a '''vboxweb''' daemon script, which you can use by placing {{Ic|vboxweb.conf}} into {{Ic|/etc/conf.d}} and {{Ic|vboxweb.rc}} into {{Ic|/etc/rc.d}} (in the {{Ic|/etc/conf.d/vboxweb}}, you should take care of '''VBOXWEB_USER''' variable which should be set to the system username running the the {{Ic|vboxwebsrv}} command).
Available in community {{Pkg|virtualbox}} contains the '''vboxweb.service''' for [[systemd]], which you can use by placing {{Ic|vboxweb.conf}} into {{Ic|/etc/conf.d}} (in the {{Ic|/etc/conf.d/vboxweb}}, you should take care of '''VBOXWEB_USER''' variable which should be set to the system username running the the {{Ic|vboxwebsrv}} command).
=== Web interface ===
=== Web interface ===

Revision as of 17:36, 24 October 2012

phpVirtualBox is an open source, AJAX implementation of the VirtualBox user interface written in PHP. As a modern web interface, it allows you to access and control remote VirtualBox instances. Much of its verbage and some of its code is based on the (inactive) vboxweb project. phpVirtualBox was designed to allow users to administer VirtualBox in a headless environment - mirroring the VirtualBox GUI through its web interface.


To remotely control virtual machine you need two components: VirtualBox web service, running in the same OS with virtual machine, and web interface, written in PHP and therefore dependent on PHP-capable web server. Communication between them, based on SOAP protocol is currently unencrypted, so it is recommended to install both on the same machine if you do not want your username and password to be send via network as clear text.

VirtualBox web service

To use the web console, you must install virtualbox-ext-oracleAUR package from AUR.

VirtualBox web interface (phpvirtualbox)

Install phpvirtualbox from Official Repositories on a php-capable web server of your choice (Apache is suitable choice).


From here on out, it is assumed that you have a web server (with root at /srv/http) and php functioning properly.

Web service

In virtual machine settings, enable the remote desktop access and specify a port different with other virtual machines.

Every time you need to make machine remotely available execute something like this:

vboxwebsrv -b --logfile path to log file --pidfile /run/vbox/vboxwebsrv.pid --host

As user whom account you want service to be running from (--host option is not necessary if you enabled association with localhost in the /etc/host.conf).

Note: This user must be in group vboxusers!

Available in community virtualbox contains the vboxweb.service for systemd, which you can use by placing vboxweb.conf into /etc/conf.d (in the /etc/conf.d/vboxweb, you should take care of VBOXWEB_USER variable which should be set to the system username running the the vboxwebsrv command).

Web interface

Edit /etc/php/php.ini, make sure the following lines are uncommented.


Don't forget to restart the webserver like this (example for Apache):

rc.d restart httpd

Edit the example configuration file /usr/share/webapps/phpvirtualbox/config.php-example appropriately (it is well-commented and does not need explanations). Copy that file into /etc/webapps/phpvirtualbox/config.php, /usr/share/webapps/phpvirtualbox/config.php and /usr/share/webapps/phpvirtualbox/lib/config.php. Do not copy it over /usr/share/webapps/phpvirtualbox/config.php (these are the same file thanks to symlinks) and never overwrite /usr/share/webapps/phpvirtualbox/lib/config.php (this file should not be changed).

If you are running Apache as webserver, you can copy /etc/webapps/phpvirtualbox/apache.example.conf into /etc/httpd/conf/extra/phpvirtualbox.conf, and then add following line into /etc/httpd/conf/httpd.conf:

Include conf/extra/phpvirtualbox.conf

Edit /etc/webapps/phpvirtualbox/.htaccess and remove the following line.

deny from all


If everything works fine, visit http://YourVboxWebInterfaceHost/phpvirtualbox and it should show a login box. The initial username and password are both "admin", after login change them from the web interface (File -> change password). If you set $noAuth=true in the web interface config.php, you should immediately see the phpvirtualbox web interface.


If you encounter a login problem, and you have upgraded virtualbox from 3.2.x to 4.0.x, you should run the following command to update you websrvauthlibrary in you virtualbox configuration file which has been changed from VRDPAuth.so to VBOXAuth.so.

VBoxManage setproperty vrdeauthlibrary default
VBoxManage setproperty websrvauthlibrary default 

If you are still unable to login into the interface, you can try to disable webauth by

VBoxManage setproperty websrvauthlibrary null

on virtualization server and set username and password to empty strings and set $noAuth=true in /etc/webapps/phpvirtualbox/config.php on web server. By doing this, you should immediatelly access the web interface without login process. And then, maybe you can try some apache access control.

External Resources