Enabling libvirt-php module

Note: The following article describes how to enable libvirt-php module in your PHP configuration. This is done automatically by make install so normally you can ignore this article. However if you experience any issues during installation and you don't have the extension enabled yet it could help you to solve the issue.

Before you start using the module you have to install the module first. The module is being generated when you compile it. This is necessary to be loaded in the extensions sections of php.ini file for PHP version older than PHP-5.

Starting with PHP-5 you can create a file called libvirt.ini in your /etc/php.d directory having just one line:

This enables the extension for PHP. Of course, you need to have this module copied in the directory with the rest of your PHP modules to make PHP find the module for you.

If you're using PHP as a module ( in the Apache webserver you need to restart your Apache to trigger configuration reload for PHP.

If you're not sure that you have everything set up right and you don't want to restart your Apache webserver before you're sure everything will be working fine you could try running the test using cli-based PHP interpreter. There are some example scripts coming along the source codes in the example subdirectory so you can try to run php on the index.php script to check whether it's working fine to establish connection or not.

When you're having some issues with the connection make sure the apache user is having access to libvirt. For more information please see Libvirt access control page.