php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38840 The Microsoft Virtual server COM object works with VB script but not on PHP
Submitted: 2006-09-15 10:31 UTC Modified: 2006-12-24 14:07 UTC
From: techscorpio at lxlabs dot com Assigned: wez (profile)
Status: Not a bug Package: COM related
PHP Version: 5.1.6 OS: windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
10 + 36 = ?
Subscribe to this entry?

 
 [2006-09-15 10:31 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:
---------------
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=============================="); 
} 
} 


Expected result:
----------------
The Virtual Server objected created

Actual result:
--------------
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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-12-24 14:07 UTC] rrichards@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

dupe of bug #38719
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 15:01:30 2024 UTC