I have installed php-libvirt as well as all required packages I have setup my php file as follows:
<?php
echo “WebAdmin 0.1Beta”;
echo “<br/>”;
$uri=”qemu:///system”;
echo (“Connecting to libvirt (URI:$uri)\n”.”<br/>”.”<br/>”);
$conn=libvirt_connect($uri,false);
if ($conn==false)
{
echo (“Libvirt last error: “.libvirt_get_last_error().”\n”);
exit;
}
However when I load the page I get:
WebAdmin 0.1Beta
Connecting to libvirt (URI:qemu:///system)
Libvirt last error: internal error Unable to locate libvirtd daemon in /usr/sbin (to override, set $LIBVIRTD_PATH to the name of the libvirtd binary)
It works fine from the command line when I run
[root@localhost ~]# virsh -c qemu:///system list
Id Name State
----------------------------------------------------
I checked Libvirtd status, it's also running
[root@localhost ~]# service libvirtd status
libvirtd (pid 14017) is running...
What could be the issue?
Do you have
libvirtd
executable in/usr/sbin
?You should find where it is and point
$LIBVIRTD_PATH
to the correct folder.If you run the script as non-root user then the executable could be there, just the script does not have permissions to use it.
p.s. probably this question is for Server Fault