I have installed php-libvirt as well as all required packages (I tried the remi rpm and compiling).
I have setup my php file as follows:
<?php
print_r ( libvirt_version() );
echo '<br>';
$uri="qemu+tcp:///system";
$credentials=array(VIR_CRED_AUTHNAME=>"fred",VIR_CRED_PASSPHRASE=>"fred");
echo ("Connecting to libvirt (URI:$uri)<BR>");
$conn=libvirt_connect($uri,false,$credentials);
if ($conn==false)
{
echo ("Libvirt last error: ".libvirt_get_last_error()."<br>");
exit;
} else {
$hostname=libvirt_get_hostname($conn);
echo ("hostname:$hostname<br>");
?>
However when I load the page I get:
Array ( [libvirt.release] => 2 [libvirt.minor] => 10 [libvirt.major] => 0 [connector.version] => 0.4.8 [connector.major] => 0 [connector.minor] => 4 [connector.release] => 8 )
Connecting to libvirt (URI:qemu+tcp:///system)
Libvirt last error: unable to connect to server at 'localhost:16509': Permission denied
It works fine from the command line when I run
# virsh -c qemu+tcp:///system list Please enter your authentication name: fred Please enter your password: Id Name State ----------------------------------------------------
I have tried the command line from another server to make sure it would work remotely and it was fine.
I have tried fred@hostname and that didn't work. I have tried VIR_CRED_USERNAME and that also didn't work.
What could be the issue?