You are not logged in.

#1 2017-02-12 18:23:25

jody2
Member
Registered: 2017-01-08
Posts: 20

[Solved] phpvirtualbox not properly working

hi all, I followed instructions on https://wiki.archlinux.org/index.php/VirtualBox for virtualbox and https://wiki.archlinux.org/index.php/PhpVirtualBox for phpvirtualbox. I have virtualbox working fine, I created virtual machines etc. Also vboxweb.service works fine, when i go to the login page it loads i enter the user name and password (admin/admin) then it gives an error:

There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.

The list of virtual machines will not begin auto-refreshing again until this page is reloaded.
HTTP error: 500 Internal Server Error

Details

the details are

readyState: "4"
responseText: ""
status: "500"
statusText: "Internal Server Error"

the apache logs show this error:

PHP Fatal error:  Uncaught ArgumentCountError: Too few arguments to function VBox_Enum::__construct(), 0 passed in /usr/share/webapps/phpvirtualbox/endpoints/lib/vboxconnector.php on line 5448 and exactly 2 expected in /usr/share/webapps/phpvirtualbox/endpoints/lib/vboxServiceWrappers.php:225\nStack trace:\n#0 /usr/share/webapps/phpvirtualbox/endpoints/lib/vboxconnector.php(5448): VBox_Enum->__construct()\n#1 /usr/share/webapps/phpvirtualbox/endpoints/lib/vboxconnector.php(4117): vboxconnector->_mediumGetDetails(Object(IMedium))\n#2 /usr/share/webapps/phpvirtualbox/endpoints/lib/vboxconnector.php(951): vboxconnector->remote_vboxGetMedia(NULL)\n#3 /usr/share/webapps/phpvirtualbox/endpoints/api.php(316): vboxconnector->__call('vboxGetMedia', Array)\n#4 {main}\n  thrown in /usr/share/webapps/phpvirtualbox/endpoints/lib/vboxServiceWrappers.php on line 225, referer: https://10.0.0.3/phpvirtualbox/

some info on my system:

Linux fatzo 4.9.8-1-ARCH #1 SMP PREEMPT Mon Feb 6 12:59:40 CET 2017 x86_64 GNU/Linux
php 7.1.1-1
apache 2.4.25-1
virtualbox 5.1.14-1
phpvirtualbox 5.0_5-1

info on my config:
content of /etc/webapps/phpvirtualbox/config.php

<?php
/**
 * phpVirtualBox example configuration.
 * @version $Id: config.php-example 585 2015-04-04 11:39:31Z imoore76 $
 *
 * rename to config.php and edit as needed.
 *
 */
class phpVBoxConfig {

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

/* SOAP URL of vboxwebsrv (not phpVirtualBox's URL) */
var $location = 'http://localhost:18083/';

/* Default language. See languages folder for more language options.
 * Can also be changed in File -> Preferences -> Language in
 * phpVirtualBox.
 */
var $language = 'en';

/* Set the standard VRDE Port Number / Range, e.g. 1010-1020 or 1027 */
var $vrdeports = '9000-9100';

/*
 *
 * Not-so-common options / tweaking
 *
 */

// Multiple servers example config. Uncomment (remove /* and */) to use.
// Add ALL the servers you want to use. Even if you have the server set
// above. The default server will be the first one in the list.
/*
var $servers = array(
        array(
                'name' => 'London',
                'username' => 'user',
                'password' => 'pass',
                'location' => 'http://192.168.1.1:18083/',
                'authMaster' => true // Use this server for authentication
        ),
        array(
                'name' => 'New York',
                'username' => 'user2',
                'password' => 'pass2',
                'location' => 'http://192.168.1.2:18083/'
        ),
);
*/

// Disable authentication
#var $noAuth = true;

// Host / ip to use for console connections
var $consoleHost = '10.0.0.3';

// Disable "preview" box
#var $noPreview = true;

// Default preview box update interval in seconds
var $previewUpdateInterval = 30;

// Preview box pixel width
var $previewWidth = 180;

// Max number of progress operations to keep in list
var $maxProgressList = 5;

// Change default preview aspect ratio to 1.
// http://www.wikipedia.org/wiki/Aspect_ratio_%28image%29#Previous_and_presently_used_aspect_ratios
#var $previewAspectRatio = 1.6;

// Enable custom VM icons
#var $enableCustomIcons = true;

/*
Exclusively use phpVirtualBox's groups configuration rather than VirtualBox groups.
This has the following effects:

*) Group changes made in phpVirtualBox will not be reflected in VirtualBox programs such as
	VirtualBox and VBoxManage
*) Group changes will not affect which folder a VM is placed in
*) You can rename groups that contain running VMs and move / copy running VMs to groups
*/
#var $phpVboxGroups = true;


/*
Allow to prompt deletion hard disk files on removal from Virtual Media Manager.
If this is not set, files are always kept. If this is set, you will be PROMPTED
to decide whether or not you would like to delete the hard disk file(s) when you
remove a hard disk from virtual media manager. You may still choose not to delete
the file when prompted.
*/
var $deleteOnRemove = true;

/*
 * File / Folder browser settings
 */

// Restrict file types
var $browserRestrictFiles = array('.iso','.vdi','.vmdk','.img','.bin','.vhd','.hdd','.ovf','.ova','.xml','.vbox','.cdr','.dmg','.ima','.dsk','.vfd');

// Restrict locations / folders
#var $browserRestrictFolders = array('D:\\','C:\\Users\\Ian'); // Or something like array('/home/vbox','/var/ISOs')

// Force use of local, web server based file browser instead of going through vboxwebsrv
var $browserLocal = true;

// Disable file / folder browser.
#var $browserDisable = true;

// Disable Windows drive detection
var $noWindowsDriveList = true;

// Just list all drives from C:\ - Z:\ without checking if they exist or not.
// This may be required on older Windows systems with more than one drive.
#var $forceWindowsAllDriveList = true;

/*
 * Misc
 */

/*
 * Auto-refresh interval in seconds for VirtualBox host memory usage information.
 * Any value below 3 will be ignored.
 */
var $hostMemInfoRefreshInterval = 5;

/* Show % of free host memory instead of % used */
#var $hostMemInfoShowFreePct = true;

/*
 * VM Memory warnings.
 *
 * If $vmMemoryStartLimitWarn is enabled, each time a VM is started through
 * phpVirtualBox, it will check that the available host memory is greater than
 * the base and video memory of the VM + 50MB (a little bit of overhead). If it
 * is not, a confirmation dialog will be presented to confirm that you want to
 * start the VM.
 *
 * If $vmMemoryOffset is set (and $vmMemoryStartLimitWarn), $vmMemoryOffset
 * megabytes is subtracted from the available host memory before the check is
 * performed by $vmMemoryStartLimitWarn logic. For instance it may be a good
 * idea to always have VM memory requirements + 100MB free. 100 is the default.
 */
#var $vmMemoryStartLimitWarn = true;
#var $vmMemoryOffset = 100;


/*
 * Display guest additions version of a running VM on its Details tab
 */
#var $enableGuestAdditionsVersionDisplay = true;

/* Disable any of phpVirtualBox's main tabs */
#var $disableTabVMSnapshots = true; // Snapshots tab
#var $disableTabVMConsole = true; // Console tab

/* Screen resolutions for console tab */
var $consoleResolutions = array('640x480','800x600','1024x768','1280x720','1440x900');

/* Console tab keyboard layout. Currently Oracle's RDP client only supports EN and DE. */
var $consoleKeyboardLayout = 'EN';

/* Max number of network cards per VM. Do not set above VirtualBox's limit (typically 8) or below 1 */
var $nicMax = 4;

/* Enable advanced configuration items (normally hidden in the VirtualBox GUI)
 * Note that some of these items may not be translated to languages other than English.
 */
var $enableAdvancedConfig = true;

/* Enable startup / shutdown configuration.
 * This only works in linux and you must add the vboxinit file to
 * your startup scripts list.
 */
#var $startStopConfig = true;

// Authentication library.
// var $authLib = 'Builtin';

// VM ownership
#var $enforceVMOwnership = true;

// Per-user VM quota
#var $vmQuotaPerUser = 2;


// Allow VDE network configuration. This must be supported by the underlying VirtualBox installation!
// If you do not know what VDE networking is - you do not need it, it is probably not supported by your
// VirtualBox installation and will cause errors if enabled.
#var $enableVDE = true;

// Disable setting SATA controllers port count to the max port number found when saving VMs.
#var $disableSataPortCount = true;

/* Enable Parallel Port configuration - EXPERIMENTAL
LPT support may or may not work for you.
!!! VirtualBox LPT support only works in Linux. !!!
*/
#var $enableLPTConfig = true;

/* Enable HardDisk IgnoreFlush configuration. This controls the "ExtraData" setting
 * in "VBoxInternal/Devices/[controller type]/0/LUN#[x]/Config/IgnoreFlush". See
 * Responding to guest IDE/SATA flush requests at:
 * http://www.virtualbox.org/manual/ch12.html#idp12757424
*/
#var $enableHDFlushConfig = true;

/*
 * Event listener timeout in seconds. This is an advanced option that most people will
 * probably not need to change.
 */
#var $eventListenerTimeout = 20;

/* END SETTINGS  */


}
?>

content of my /etc/httpd/conf/extra/phpvirtualbox.conf

 
  Alias /phpvirtualbox "/usr/share/webapps/phpvirtualbox"
  <Directory "/usr/share/webapps/phpvirtualbox">
    Require all granted
    php_admin_value open_basedir "/home/jody/VirtualBox VMs/:/srv/http/:/home/:/home/jody/:/home/vbox/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/etc/webapps/:/etc/webapps/phpvirtualbox/:/usr/share/webapps/phpvirtualbox/"
    AuthType Basic
    AuthBasicProvider file
    AuthName "nothing to see"
    AuthUserFile /etc/srv/.htpasswd
    Require valid-user
  </Directory>

the service status of vboxweb.service:

● vboxweb.service - VirtualBox Web Service
   Loaded: loaded (/usr/lib/systemd/system/vboxweb.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2017-02-12 17:24:50 UTC; 54min ago
  Process: 4660 ExecStart=/usr/bin/vboxwebsrv --logfile /var/log/vbox.log --pidfile /run/vbox/vboxweb.pid --background (code=exited, status=0/SUCCESS)
 Main PID: 4676 (vboxwebsrv)
    Tasks: 25 (limit: 4915)
   CGroup: /system.slice/vboxweb.service
           ├─4676 /usr/lib/virtualbox/vboxwebsrv --logfile /var/log/vbox.log --pidfile /run/vbox/vboxweb.pid --background
           ├─4678 /usr/lib/virtualbox/VBoxXPCOMIPCD
           └─4684 /usr/lib/virtualbox/VBoxSVC --auto-shutdown

Feb 12 17:24:50 jody vboxwebsrv[4660]: 00:00:00.000185 main     OS Release: 4.9.8-1-ARCH
Feb 12 17:24:50 jody vboxwebsrv[4660]: 00:00:00.000186 main     OS Version: #1 SMP PREEMPT Mon Feb 6 12:59:40 CET 2017
Feb 12 17:24:50 jody vboxwebsrv[4660]: 00:00:00.000228 main     DMI Product Name: To Be Filled By O.E.M.
Feb 12 17:24:50 jody vboxwebsrv[4660]: 00:00:00.000240 main     DMI Product Version: To Be Filled By O.E.M.
Feb 12 17:24:50 jody vboxwebsrv[4660]: 00:00:00.000344 main     Host RAM: 64398MB (62.8GB) total, 58100MB (56.7GB) available
Feb 12 17:24:50 jody vboxwebsrv[4660]: 00:00:00.000360 main     Executable: /usr/lib/virtualbox/vboxwebsrv
Feb 12 17:24:50 jody vboxwebsrv[4660]: 00:00:00.000361 main     Process ID: 4660
Feb 12 17:24:50 jody vboxwebsrv[4660]: 00:00:00.000362 main     Package type: LINUX_64BITS_GENERIC (OSE)
Feb 12 17:24:50 jody systemd[1]: vboxweb.service: Supervising process 4676 which is not our child. We'll most likely not notice when it exits.
Feb 12 17:24:50 jody systemd[1]: Started VirtualBox Web Service.

how to get this fixed, searched around for a while but can't find a solution, please help smile

Last edited by jody2 (2017-02-21 08:06:40)

Offline

#2 2017-02-21 08:06:23

jody2
Member
Registered: 2017-01-08
Posts: 20

Re: [Solved] phpvirtualbox not properly working

ok, the problem was PHP version, once upgraded to current php (7.1.2) it all works fine without a problem. see here: https://github.com/imoore76/phpvirtualbox/pull/24 and here https://sourceforge.net/p/phpvirtualbox … /?limit=25

Offline

Board footer

Powered by FluxBB