#43506 [NEW]: com_get_active_object always fails

From: Date: Wed, 05 Dec 2007 18:14:58 +0000
Subject: #43506 [NEW]: com_get_active_object always fails
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-120400@lists.php.net to get a copy of this message
From: bvandermerwe at kbcat dot com Operating system: Windows XP PHP version: 5.2.5 PHP Bug Type: COM related Bug description: com_get_active_object always fails Description: ------------ com_get_active_object always returns "Operation Unavailable " even when it should work for sure. Let me demonstrate: Start up Microsoft Word (for example) on the server machine where Apache and PHP are running. Then put the following text in a file called x.vbs: Dim app Set app = GetObject(,"Word.Application") if app is nothing then wscript.echo "Got nothing" else wscript.echo "Got it!" end if Execute it by typing: cscript x.vbs. Note that it works fine. Yet the following line in a PHP script always returns "Operation Unavailable ": $obj = com_get_active_object("Word.Application"); Using: $obj = new COM("Word.Application") works (meaning PHP COM is working). I just upgraded Apache to 2.2.6 and PHP 5.2.5 (using the Windows installation executable binaries with pretty much default settings, except PHP is in c:\PHP525 and I checked the options for MS and MYSQL databases). Bugzilla and several PHP applications all work fine. But it seems com_get_active_object *always* fails. I have Googled and I can not find any examples of it out there or any security or other settings related to it. If it just calls GetObject, then how come calling GetObject from VBScript works but in PHP does not? I did discover that some GetObject calls are disabled under IIS for security reasons, but I am using Apache and there is no reference to any setting that needs to be turned on before this will work. Reproduce code: --------------- <!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" lang="en-US"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Test</title> </head> <body> <?php echo("<p>Attempting to retrieve COM Object</p>"); $obj = com_get_active_object("Word.Application"); //Fails! if ($obj) { echo("<p>Object Found</p>"); } else { echo("<p>Object NOT Found</p>"); } ?> </body> </html> Expected result: ---------------- No error. You should see: Attempting to retrieve COM Object Object Found Actual result: -------------- You see: Attempting to retrieve COM Object If PHP error tracing is enabled you also see: Fatal error: Uncaught exception 'com_exception' with message 'Operation unavailable ' in C:\ApacheDocumentRoot\test_com.php:10 Stack trace: #0 C:\ApacheDocumentRoot\test_com.php(10): com_get_active_object('Word.Application') #1 {main} thrown in C:\ApacheDocumentRoot\test_com.php on line 10 -- Edit bug report at http://bugs.php.net/?id=43506&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43506&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43506&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43506&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43506&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43506&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43506&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43506&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=43506&r=needscript Try newer version: http://bugs.php.net/fix.php?id=43506&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43506&r=support Expected behavior: http://bugs.php.net/fix.php?id=43506&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43506&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43506&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43506&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43506&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43506&r=dst IIS Stability: http://bugs.php.net/fix.php?id=43506&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43506&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43506&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43506&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=43506&r=mysqlcfg

« previous php.bugs (#120400) next »