note 37108 added to ref.com
| From: | feelingflash at hotmail dot com | Date: | Mon, 03 Nov 2003 17:13:52 +0000 |
| Subject: | note 37108 added to ref.com | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-59725@lists.php.net to get a copy of this message | ||
PROBLEM QUITTING MICROSOFT EXCEL
I have been trying to solve the problem of terminating the excel process when using the COM
functionality. I found a few 'supposed fixes' including not using arrays etc but none of
them seemed to work. Example:
$excel->application->Quit();
$excel->Quit();
None of these variants properly quit the process - ONLY the visible application. Several hours of
using your code would leave thousands of excel processes running invisibly in the background and
eating all your ram very quickly.
As I was developing on a solution designed to work on clients running windows, my solution was to
install microsofts 'kill.exe' into the windows directory and then run it using:
shell_exec("kill excel.exe");
One problem is because kill.exe is an add on utility, some clients running windows will not have it.
The solution is then to use file_exists(filename) to detect for the file and then if not present,
let the user download it. Example:
$killApp = "C:\WINDOWS\KILL.EXE";
if (file_exists($killApp)) {
# continue
} else {
# show message and link to kill.exe download
}
----
Manual Page -- http://www.php.net/manual/en/ref.com.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+37108
Delete -- http://master.php.net/manage/user-notes.php?action=delete+37108&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+37108&report=yes
Search -- http://master.php.net/manage/user-notes.php