php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38719 COM Error during accessing function VirtualMachines
Submitted: 2006-09-05 06:50 UTC Modified: 2020-02-16 04:22 UTC
Votes:30
Avg. Score:4.6 ± 0.7
Reproduced:27 of 27 (100.0%)
Same Version:10 (37.0%)
Same OS:13 (48.1%)
From: techscorpio at lxlabs dot com Assigned: cmb (profile)
Status: No Feedback Package: COM related
PHP Version: 5.1.6 OS: Windows 2003 r2
Private report: No CVE-ID: None
 [2006-09-05 06:50 UTC] techscorpio at lxlabs dot com
Description:
------------
Hi,
 i am trying to warite a php script for administration of microsoft virtual server when i use a COM "VirtualServer.Application" the object is created but when i tried to access "VirtualMachines" etc,the COM function will troughs error.

Reproduce code:
---------------
Hi, 

I tried many times but still it's troughing the same error, i tried some other example but it seems actual problem is in php, it will not accessing COM properly i tried like this 

vb script:- 

'Script Begins 

On Error Resume Next 

'Connect to Virtual Server 
Set virtualServer = CreateObject("VirtualServer.Application") 

'Get collection of virtual machines 
set vmCollection = virtualServer.VirtualMachines 

'Iterate over the virtual machines and display data 
For Each vm in vmCollection 
Wscript.Echo "==============================" 
Wscript.Echo "Name: " & vm.Name 
Wscript.Echo 
Wscript.Echo "Notes: " & vm.Notes 

Wscript.Echo "==============================" 

Next 

'Script Ends 

Works Fine 

PHP Script 

<?php 
f1(); 
function f1() 
{ 
//Connect to Virtual Server 
$virtualServer = new COM("VirtualServer.Application"); 

//Get collection of virtual machines 
$vmCollection = $virtualServer->VirtualMachines; 
//Iterate over the virtual machines and display data 
foreach( $vmCollection as $vm) 
{ 
print("\n=============================="); 
print( "\nName: " $vm->Name); 
print("\n=============================="); 
} 
} 
Throughs Run time ERROR: 
Fatal error: Uncaught exception 'com_exception' with message 'Source: Unknown 
Description: Unknown' in C:\Program Files\lxlabs\ext\php\test.php:9 
Stack trace: 
#0 C:\Program Files\lxlabs\ext\php\test.php(9): f1() 
#1 C:\Program Files\lxlabs\ext\php\test.php(2): f1() 
#2 {main} 
thrown in C:\Program Files\lxlabs\ext\php\test.php on line 9 


When i cought Exception it will tough Object #2 

please help me it's urgent

Expected result:
----------------
it will show all the virtual machines under virtual server

Actual result:
--------------
Fatal error: Uncaught exception 'com_exception' with message 'Source: Unknown 
Description: Unknown' in C:\Program Files\lxlabs\ext\php\test.php:9 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-12-11 18:56 UTC] ana dot laura123 at gmail dot com
I have the same error. I'm trying to start a new php process to run a php script in the background. This is what i'm doing:

$WshShell = new COM("WScript.Shell");
$oExec = $WshShell->Run('C:\php\php.exe startEngine.php'); 

the script runs ok when i start it from a command window.
but it gives me this error when i try to run it from a php page:

Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> Unknown<br/><b>Description:</b> Unknown' in c:\Inetpub\wwwroot\M3PHP\Engine\EngineService.php:60 Stack trace: #0 c:\Inetpub\wwwroot\M3PHP\Engine\EngineService.php(60): com->Run('C:\php\php.exe ...') #1 {main} thrown in c:\Inetpub\wwwroot\M3PHP\Engine\EngineService.php on line 60
PHP Fatal error: Uncaught exception 'com_exception' with message 'Source: Unknown
Description: Unknown' in c:\Inetpub\wwwroot\M3PHP\Engine\EngineService.php:60 Stack trace: #0 c:\Inetpub\wwwroot\M3PHP\Engine\EngineService.php(60): com->Run('C:\php\php.exe ...') #1 {main} thrown in c:\Inetpub\wwwroot\M3PHP\Engine\EngineService.php on line 60
 [2007-06-20 02:55 UTC] jim_1234au at yahoo dot com dot au
Has there any progress, or workaround with this problem ?

I've just tried it with Apache/2.2.4 (Win32) PHP/5.2.3 on a Windows 2003R2 server. The same was orrucing with PHP v5.2.2.

Jim.....
 [2008-10-04 23:05 UTC] pykker at gmail dot com
I tried on Windows Vista SP1, PHP 5.2.1 and getting the same error.

Are there any news about this?
 [2009-05-27 02:26 UTC] jstel at 126 dot com
i get same error .

the error code is 

Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> Unknown<br/><b>Description:</b> Unknown' in D:\xampp\htdocs\snap\snap.php:4 Stack trace: #0 D:\xampp\htdocs\snap\snap.php(4): unknown() #1 {main} thrown in D:\xampp\htdocs\snap\snap.php on line 4


my source code is from demo of 

http://cn.php.net/manual/en/function.imagegrabwindow.php

<?php
$browser = new COM("InternetExplorer.Application");
$handle = $browser->HWND;
$browser->Visible = true;
$browser->Navigate("http://www.libgd.org");

/* Still working? */
while ($browser->Busy) {
    com_message_pump(4000);
}
$im = imagegrabwindow($handle, 0);
$browser->Quit();
imagepng($im, "iesnap.png");
imagedestroy($im);
?>
 [2011-08-10 08:22 UTC] pe dot dolenc at gmail dot com
Hello guys,
I've had similar problems trying to start application in the background, but 
always getting the Source: Unknown error.

For me the cause was, that backslashes weren't escaped, so please double check 
your code.
 [2013-12-13 07:47 UTC] wez@php.net
-Status: Assigned +Status: Open -Assigned To: wez +Assigned To:
 [2020-02-06 17:54 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2020-02-06 17:54 UTC] cmb@php.net
First, a com_exception with the message "Source: Unknown
Description: Unknown" is thrown when a dispatch exception occurs,
but the automation server does neither provide a source nor a
description.  That means this is a rather generic error message,
which does not tell anything about the root cause.  Likely, the
different commenters here have different issues.

Regarding the OP: Microsoft Virtual Server had its last release in
2007, so I assume this issue is obsolete.  Am I wrong?

> the script runs ok when i start it from a command window.
> but it gives me this error when i try to run it from a php page:

This hints at some environmental issues (maybe insufficient
permissions).

Regarding the imagegrabwindow() example from the docs: while I
don't get any error or exception, I get a completely black image.
A quick look at the implementation of imagegrabwindow() shows that
the error handling should be improved.

And I think the error handling of this particular com_exception
should also be improved, but that is tracked in bug #51904.
 [2020-02-16 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 17:01:32 2024 UTC