Hi Michal,

Here's what appears in the logfile when using libvirt_logfile_set:

[Wed Jun 29 15:18:00 2011] [error] [client 10.9.1.10] PHP Warning:  libvirt_connect(): internal error HTTP response code 500 for call to 'Login'. Fault: ServerFaultCode - Cannot complete login due to an incorrect user name or password. in /var/www/virt.php on line 9, referer: http://10.9.0.3/
[2011-06-29 15:18:00 libvirt-php/core]: libvirt_connect: Cannot establish connection to esx://10.9.0.2?transport=http

Best regards,
Koen Calliauw

On Wed, Jun 29, 2011 at 3:10 PM, Michal Novotny <minovotn@redhat.com> wrote:
Hi Koen,
thanks for you e-mail. I don't know what exactly is going on here but
could you please try to enable debug logging using

libvirt_logfile_set($filename, $maxsize)

API function? The maxsize parameter is optional and it defaults to 1024
KiB (1M). The file have to have write permissions so you can touch the
file, e.g. debug.log and change it's permissions to 777 to allow
logging. Once you try to login using the script you mentioned with debug
set you will get the debug output into the debug.log file which could be
send to us for further analysis.

Thanks,
Michal


On 06/29/2011 03:03 PM, Koen Calliauw wrote:
> Hi all,
>
> I've started playing with libvirt-php yesterday and with the help of
> Michal Novotny got it running quite painlessly. However, the login
> from PHP to my testing ESXi server seems to be failing. I've
> wiresharked the HTTP traffic with a virsh -c (which works) and
> compared that to the traffic I see when using the libvirt-php
> extension, here's the difference I see (mind the username)
>
> Not working (libvirt-php)
>
> <Login xmlns="urn:vim25"><_this xmlns="urn:vim25"
> xsi:type="ManagedObjectReference"
> type="SessionManager">ha-sessionmgr</_this><userName xmlns="urn:vim25"
> xsi:type="xsd:string">root8.</userName><password xmlns="urn:vim25"
> xsi:type="xsd:string">fakepass</password></Login>
>
> Working (virsh -c)
>
> <Login xmlns="urn:vim25"><_this xmlns="urn:vim25"
> xsi:type="ManagedObjectReference"
> type="SessionManager">ha-sessionmgr</_this><userName xmlns="urn:vim25"
> xsi:type="xsd:string">root</userName><password xmlns="urn:vim25"
> xsi:type="xsd:string">fakepass</password></Login>
>
> So for some reason something gets appended (8.) or encoded wrong or
> something when I use the PHP extension. This is the testing code I run:
>
> <?php
> $credentials =
> array(VIR_CRED_AUTHNAME=>'root',VIR_CRED_PASSPHRASE=>'fakepass');
> $conn = libvirt_connect("esx://10.9.0.2?transport=http
> <http://10.9.0.2?transport=http>", FALSE, $credentials);
> if($conn) {
>     print_r(libvirt_connect_get_hypervisor($conn));
>
> } else {
>     echo "Connection failed: ".libvirt_get_last_error();
> }
>
> Any help with this issue would be greatly appreciated. Thanks!
>
> Best regards,
> Koen Calliauw


--
Michal Novotny <minovotn@redhat.com>, RHCE, Red Hat
Virtualization | libvirt-php bindings | php-virt-control.org