Ubuntu 22.04下phpVirtualBox无法连接vboxweb-service求助
问题:phpVirtualBox无法连接到vboxwebsrv(错误代码64)
在Ubuntu 22.04系统中使用最新版phpVirtualBox登录VirtualBox(版本7.0.12r159484)GUI时,出现无法连接到http://127.0.0.1:18083/的错误,异常代码为64。已尝试禁用认证、重新安装,但问题仍未解决,需解决登录问题。
错误详情
Exception Object ( [message:protected] => Could not connect to host (http://127.0.0.1:18083/) [string:Exception:private] => [code:protected] => 64 [file:protected] => /var/www/html/phpvirtualbox/endpoints/api.php [line:protected] => 134 [trace:Exception:private] => Array ( ) [previous:Exception:private] => )
相关配置
config.php配置
/* Username / Password for system user that runs VirtualBox */ var $username = 'admin'; var $password = 'admin'; /* SOAP URL of vboxwebsrv (not phpVirtualBox's URL) */ var $location = 'http://127.0.0.1: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'; /* Set the default VRDE address, e.g. 192.168.1.1 */ #var $vrdeaddress = '192.168.1.1';
/etc/default/virtualbox配置
cat /etc/default/virtualbox VBOXWEB_USER=vbox VBOXWEB_HOST=127.0.0.1 VBOXWEB_PORT=18083
vboxweb-service服务状态
root@daspletosaurus /var/www/html/phpvirtualbox # systemctl status vboxweb-service ● vboxweb-service.service Loaded: loaded (/usr/lib/virtualbox/vboxweb-service.sh; enabled; vendor preset: enabled) Active: active (exited) since Mon 2023-11-13 09:31:34 UTC; 1h 10min ago CPU: 3ms Nov 13 09:31:34 daspletosaurus systemd[1]: Starting vboxweb-service.service... Nov 13 09:31:34 daspletosaurus systemd[1]: Started vboxweb-service.service.
权限信息
drwxr-xr-x 10 www-data vboxusers 4096 Nov 13 10:36 phpvirtualbox/
排查与解决步骤
- 确认vboxwebsrv进程是否运行:执行
ps aux | grep vboxwebsrv,无结果则说明服务未正常启动。 - 检查vbox用户组归属:执行
id vbox,确认该用户属于vboxusers组。 - 查看服务启动日志:执行
journalctl -u vboxweb-service,定位启动失败的具体原因。 - 修正config.php用户配置:将
$username改为vbox(与/etc/default/virtualbox中VBOXWEB_USER一致),并设置为该系统用户的密码。 - 重启服务并检查状态:执行
systemctl restart vboxweb-service,再次查看状态应为active (running)而非active (exited)。 - 测试端口连通性:执行
curl http://127.0.0.1:18083/,若提示连接拒绝,说明端口未被监听,需结合日志排查服务启动问题。
内容的提问来源于stack exchange,提问作者Fane Fanucu
相关产品推荐
相关产品推荐

