Destroy guest OS using php
- by Alee
I am using libvirt-php to manage my virtual machines, and I need to shutdown/destroy domU.
For this I used the following php script:
< ? php $conn=libvirt_connect("xen:///");
$name=libvirt_domain_lookup_by_id($conn,4);
$dest=libvirt_domain_destroy($name);
echo $dest; ?
When I run this on xampp server i get the following output:
Warning: libvirt_domain_destroy() [function.libvirt-domain-destroy]:
operation virDomainDestroy forbidden for read only access in
/opt/lampp/htdocs/xampp/byname.php on line 5.
Here is the documentation: http://libvirt.org/php/api-reference.html#libvirt_domain_destroy