[libvirt] pibvirt php help

Michal Novotny minovotn at redhat.com
Thu Jan 19 16:00:58 UTC 2012


Oh, that's interesting. So you can connect fine with the virsh but not
libvirt-php?

Now I may see your point, the issue is in the apache user. You need to
use the apache-key-copy utility (bundled with the php-virt-control) to
generate a key to your apache user account (provided the fact your
apache is running under user apache). This will generate the key (if it
doesn't exist) and transfer it to the destination machine using
ssh-copy-id. The syntax for apache-key-copy is:

apache-key-copy hostname_or_ip

that should be:

apache-key-copy 192.168.102.133

for your case. However it can copy only to root account and not any user
account yet, i.e. you have to connect using

qemu+ssh://root@192.168.102.133/system

and for no other user than root is working yet. You can patch the
apache-key-copy to include the optional user account name and send a
patch to php-virt-control list if you want to.

Michal


On 01/19/2012 04:41 PM, punit gupta wrote:
> sir 
>    i am trying to create ssh connention and i am able to connect with
> out password from terminal using 
> virsh -c qemu+ssh://punit@192.168.102.133/system
> <http://punit@192.168.102.133/system> 
>
> but this is not working with libvirt-php binding 
>
> error :for libvirt-php ssh connection
> "Libvirt last error: cannot recv data: Resource temporarily unavailable"
>
> my php code is
> <?php
>
> $res1=libvirt_connect("qemu+ssh://punit@192.168.102.133/system
> <http://punit@192.168.102.133/system>",false);
>
>
> print_r($res1); printf ("\n");
>
> if ($res1==false)
> {
>     echo ("Libvirt last error: ".libvirt_get_last_error());
>     
> }
> ?>
>
>
>
>
> -- 
> Punit Gupta
> M-Tect (jiit noida)
>
>
>
>
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list


-- 
Michal Novotny <minovotn at redhat.com>, RHCE, Red Hat
Virtualization | libvirt-php bindings | php-virt-control.org




More information about the libvir-list mailing list