
On Wed, Oct 26, 2011 at 11:31 AM, vmnode guy <vmnodeguy@gmail.com> wrote:
Hello HetZ,
I try the put in the example and try run, but it's don't seem to be works.
Do you have the same problem, do you know how should i proceed ?
root@cn1:/var/www# cat info.php <?php
print_r ( libvirt_version() );
$conn = libvirt_connect('null', false); // $conn = libvirt_connect('qemu+ssh://root@10.0.0.122/system', false); echo $conn; $doms = libvirt_list_domains($conn); print_r($doms);
?> root@cn1:/var/www#
It doesn't show any output..
I also put this example into a file log.php and run it.
<?php $logfile = 'test.log';
unlink($logfile); if (!libvirt_logfile_set($logfile)) die('Cannot set the log file');
$conn = libvirt_connect('null', false); unset($conn);
$fp = fopen($logfile, 'r'); $str = fread($fp, filesize($logfile)); fclose($fp);
echo $str; ?>
It does generate a file and show error.. [Wed Oct 26 23:17:07 2011] [error] [client 10.0.0.201] PHP Warning: libvirt_connect(): Failed to connect socket to '@/var/www/.libvirt/libvirt-sock': Connection refused in /var/www/log.php on line 8 [2011-10-26 23:17:07 libvirt-php/core]: libvirt_connect: Cannot establish connection to (null)
My /var/www directory is like below:- root@cloudnode1:/var/www# ls -laR .: total 36 drwxr-xr-x 4 www-data www-data 4096 2011-10-26 23:20 . drwxr-xr-x 15 root root 4096 2011-10-26 22:40 .. -rw-r--r-- 1 www-data www-data 177 2011-10-26 22:40 index.html -rw-r--r-- 1 www-data www-data 229 2011-10-26 23:16 info.php drwxr-xr-x 2 root root 4096 2011-10-26 23:15 .libvirt -rw-r--r-- 1 www-data www-data 313 2011-10-26 22:59 log.php drwx------ 2 www-data www-data 4096 2011-10-26 23:12 .ssh -rw-r--r-- 1 www-data www-data 4619 2011-10-26 23:17 test.log
./.libvirt: total 8 drwxr-xr-x 2 root root 4096 2011-10-26 23:15 . drwxr-xr-x 4 www-data www-data 4096 2011-10-26 23:20 .. lrwxrwxrwx 1 www-data www-data 29 2011-10-26 23:02 .libvirt-sock -> /var/run/libvirt/libvirt-sock
./.ssh: total 16 drwx------ 2 www-data www-data 4096 2011-10-26 23:12 . drwxr-xr-x 4 www-data www-data 4096 2011-10-26 23:20 .. -rw------- 1 www-data www-data 1675 2011-10-26 23:11 id_rsa -rw-r--r-- 1 www-data www-data 401 2011-10-26 23:11 id_rsa.pub root@cloudnode1:/var/www#
Regards, Peter
Not sure what you're trying to do but I believe if you're trying to give null for connection, you should use null without quotes [2011-10-26 23:17:07 libvirt-php/core]: libvirt_connect: Cannot establish connection to (null) Could you try this possibly? $conn = libvirt_connect(null, false); PS, I have never used the PHP bindings but I just noticed that. -- Mohammed Naser — vexxhost ----------------------------------------------------- D. 514-316-8872 D. 800-910-1726 ext. 200 E. mnaser@vexxhost.com W. http://vexxhost.com