Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

can anybody help me to display details about the VM using PHP code. am using Ubuntu server and used KVM as hypervisor. Am trying to display cores, ram, memory alloted each VM.

i have tried all the shell commands in php using shell_exec and exec.

Without installing any tool.

share|improve this question

1 Answer 1

You can install libvirt php extension to communicate wit libvirtd. See the instructions here.

Once installed you can tryout some sample examples like :

 print_r( libvirt_version() );

Sample Output of above code will be something like:

    [libvirt.release] => 0
    [libvirt.minor] => 0
    [libvirt.major] => 1
    [connector.version] => 0.4.5
    [connector.major] => 0
    [connector.minor] => 4
    [connector.release] => 5

Refer for more examples.

The complete API reference can be found here:

Hope this helps

share|improve this answer
is it possible to have php code alone to get the output. i dont want any tool to be installed – Poorni Ma Oct 31 '12 at 6:22
Its not a tool its a PHP extension. – aneeshep Dec 7 '12 at 12:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.