Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > e85288c7a5121fbc5f974c41f3762b10 > files > 49

php-libvirt-0.4.7-5.mga4.x86_64.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
        This file is autogenerated from index.html.in
        Do not edit this file. Changes will be lost.
      -->
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" type="text/css" href="main.css" />
    <link rel="SHORTCUT ICON" href="graphics/32favicon.png" />
    <title>libvirt-php: Libvirt-php</title>
    <meta name="description" content="libvirt, virtualization, virtualization API" />
  </head>
  <body>
    <div id="header">
      <div id="headerLogo"></div>
      <div id="headerSearch">
        <form action="search.php" enctype="application/x-www-form-urlencoded" method="get">
          <div>
            <input id="query" name="query" type="text" size="12" value="" />
            <input id="submit" name="submit" type="submit" value="Search" />
          </div>
        </form>
      </div>
    </div>
    <div id="body">
      <div id="menu">
        <ul class="l0">
          <li>
            <div>
              <span class="active">Home</span>
            </div>
          </li>
          <li>
            <div>
              <a title="Details of new features and bugs fixed in each release" class="inactive" href="news.html">News</a>
            </div>
          </li>
          <li>
            <div>
              <a title="Get the latest source releases, binary builds and get access to the source repository" class="inactive" href="downloads.html">Downloads</a>
            </div>
          </li>
          <li>
            <div>
              <a title="See the list of distributions where you can find libvirt-php in their repositories" class="inactive" href="distros.html">Distributions</a>
            </div>
          </li>
          <li>
            <div>
              <a title="Information on libvirt-php Windows port" class="inactive" href="windows.html">Windows port</a>
            </div>
          </li>
          <li>
            <div>
              <a title="Information on contributing to libvirt-php" class="inactive" href="contributions.html">Contributions</a>
            </div>
          </li>
          <li>
            <div>
              <a title="Information for users, administrators and developers" class="inactive" href="docs.html">Documentation</a>
            </div>
          </li>
          <li>
            <div>
              <a title="List of companies and people using the project" class="inactive" href="references.html">References</a>
            </div>
          </li>
          <li>
            <div>
              <a title="How to contact the developers via email and IRC" class="inactive" href="contact.html">Contact</a>
            </div>
          </li>
          <li>
            <div>
              <a title="List of links related to libvirt-php project" class="inactive" href="links.html">Related links</a>
            </div>
          </li>
          <li>
            <div>
              <a title="List of features to be implemented" class="inactive" href="roadmap.html">Roadmap</a>
            </div>
          </li>
          <li>
            <div>
              <a title="Libvirt-php site map" class="inactive" href="sitemap.html">Sitemap</a>
            </div>
          </li>
        </ul>
      </div>
      <div id="content">
        <h1>Libvirt-php</h1>
        <p>libvirt-php, originally called php-libvirt, is a project that was started by Radek Hladik in 2010 to integrate libvirt support to PHP.</p>
        <p>In February 2011 the binding has been moved to libvirt.org site and it's currently maintained by Red Hat.</p>
        <p>
       <b>This project is not affiliated with The PHP Group and the PHP project itself.</b>
    </p>
        <h2>What is libvirt-php?</h2>
        <p>libvirt-php is a php module that provides PHP bindings for libvirt virtualization toolkit and therefore you can access libvirt directly from
       your PHP scripts with no need to have virt-manager or libvirt-based CLI/GUI tools installed.</p>
        <h2>Using libvirt-php</h2>
        <p>You can use <i>libvirt-php</i> extension to manage your domains (virtual machines) from your PHP scripts. This could be very useful if you
       manage several physical machines that are all serve like hosts for virtual machines. If all the host machines are running Apache webserver
       then you could easily write the management scripts using the <i>libvirt-php</i> extension to manage all of the virtual machines on the
       host.</p>
        <p>Also, if you have the libvirt authentication setup to be able to remotely connect directly from the PHP script then management tool could
       be present just on one host machine providing the remote connectivity to all other hosts to manage all of the virtual machines in your
       environment.</p>
        <h2>Checking whether libvirt-php is installed</h2>
        <p>Once you have the libvirt-php module loaded in your PHP configuration you can test it's presence using a standard PHPInfo() output where
       you could be able to see libvirt extension information if enabled or you can try to look for <i>libvirt</i> string in the <b>php -m</b>
       output (if you're having the CGI/CLI-based version of PHP installed on your system) or you can automate it e.g. by using following command:</p>
        <pre>$ php -m | grep libvirt &gt; /dev/null; echo $?</pre>
        <p>The second part after the semicolon is the next command to be processed and this will redirect the grepped <i>php -m</i> to null device so it
       will not show the command output. Instead, it will show the error code of the <i>grep</i> command which will be 0 for case the extension is
       installed properly or number 1 if the extension was not found in your PHP configuration.</p>
        <p>If you don't have access to CGI/CLI-based version version of PHP you can use a simple PHP script like:</p>
        <pre>&lt;?php
    print_r( libvirt_version() );
?&gt;</pre>
        <p>If you have libvirt-php binding installed and binding is working successfully you should see output similar to following in your PHP script::</p>
        <pre>
Array
(
    [libvirt.release] =&gt; 3
    [libvirt.minor] =&gt; 8
    [libvirt.major] =&gt; 0
    [connector.version] =&gt; 0.4.1
    [connector.major] =&gt; 0
    [connector.minor] =&gt; 4
    [connector.release] =&gt; 1
)
</pre>
        <p>Keys in this output are saying what version of libvirt and libvirt-php you are using. The keys beginning with <i>libvirt.</i> are
    libvirt daemon related and the <i>connector.</i> keys are referring to libvirt-php since libvirt-php is just a connector to libvirt
    daemon so therefore it's called <i>connector</i> in the output.</p>
        <p>If you don't have the extension installed properly you will see the error that the function <i>libvirt_version()</i> is unknown or even
    you may see error page instead if PHP configuration is bad and your PHP or Apache dies on it.</p>
      </div>
    </div>
    <div id="footer"></div>
  </body>
</html>