[libvirt] Using libvirt from PHP

Radek Hladik radek at eadresa.cz
Wed Mar 25 21:01:22 UTC 2009

	I am developing wimple web application in PHP to monitor and control 
VMs using libvirt. I hope it could become simple library for doing basic 
things with VMs. And I would like to ask for your opinion about 
different possibilities of calling libvirt.

Option 1) I am calling virsh via exec command now (one virsh for every 
libvirt command). This can be used for local libvirt but it is very 
inefficient. The overhead for remote libvirt would be unbearable. I 
could run one virsh per page and use it "interactively" so the overhead 
gets lower.
Option 2) The other option is to create Zend extension which should be 
able to call libvirt directly from C. However I've never done anything 
like that so I do not know, whether it is reasonable or not.
Option 3) I could also create some "wrapper daemon" in C or other 
language with libvirt binding. But I think that this is an ugly way :-)
Option 4) I could "talk" directly to the libvirt socket. But I am not 
sure how the communication goes there and whether it is stable or 
changes with every version. And I consider the socket to be internal 
thing of libvirt...

Is there any other option I missed? And which one would you suggest?


More information about the libvir-list mailing list