#21489 [Opn->Csd]: Excel hangs after creation via COM

From: Date: Sat, 25 Jan 2003 17:57:25 +0000
Subject: #21489 [Opn->Csd]: Excel hangs after creation via COM
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-31228@lists.php.net to get a copy of this message
ID: 21489 Updated by: phanto@php.net Reported By: achirizzi@softeam-tsa.it -Status: Open +Status: Closed Bug Type: COM related Operating System: Win 2K Server PHP Version: 4.3.0 Previous Comments: ------------------------------------------------------------------------ [2003-01-10 04:46:32] achirizzi@softeam-tsa.it I solved the problem changing the default printer on the server! It seems strange (and it is not) but if I change the printer and put a simple (native and not plugged to the server...) printer as the default printer, rather than a hand-installed one, EXCEL seems to act in the right way. (the printer in question is a Canon Laser SHOT LBP-1210) EXCEL does not show any strange behavior if it run normally by opening it via the menu. But if it is run via PHP and COM the thing happens ------------------------------------------------------------------------ [2003-01-08 21:17:35] php_general@e1da.net I see this behaviour on 4.2.3 but not with 4.3.0 on Win2Kpro SP3 Apache 1.3.27 (PHP running as module). On 4.2.3 the same Excel.exe is reused each time I run a script very similar to this one. I end up with one Excel.exe left in taskmanager after running this script "1 to n" times. In 4.3.0 Excel.exe appears for a moment while the script runs then disappears. I get exactly the same behaviour on Win2k server SP2. ------------------------------------------------------------------------ [2003-01-07 07:52:30] achirizzi@softeam-tsa.it This is the code I always used with PHP prior to 4.2.X and 4.3.0: function ExcelSheet($filein,$tmpdir) { $fileout = substr(tempnam($tmpdir, "tmp"), 0, -4); $ex = new COM("Excel.sheet") or Die ("Cannot find excel!"); $ex->Application->Visible = 0; $wkb = $ex->Application->Workbooks->Open($filein) or Die ("Cannot open excel!"); $ex->Application->ActiveWorkbook->SaveAs($fileout, -4143); $ex->application->ActiveWorkbook->Close("False"); unset($ex); return($fileout . ".xls"); } The excel function works, but afterwards the excel process remains in memory, as other people have already argued. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=21489&edit=1

« previous php.bugs (#31228) next »