php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16828 Excel remains resident in memory after using it via PHP+COM
Submitted: 2002-04-25 14:32 UTC Modified: 2002-04-27 06:15 UTC
From: scott at furt dot com Assigned:
Status: Closed Package: COM related
PHP Version: 4.2.0 OS: Win 2000
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: scott at furt dot com
New email:
PHP Version: OS:

 

 [2002-04-25 14:32 UTC] scott at furt dot com
When using Excel.Application via the COM interface with PHP version (4.1.2 and 4.2.0), EXCEL.EXE stays resident in memory after script execution.

To verify this is not an Excel issue, i created two separate scripts that did the same thing; one in perl, and one in PHP.  

After execution of the perl script, no EXCEL.EXE is in the Task list; yet after execution of the PHP script, EXCEL.EXE is in the Task list.

Some more info and test scripts are available at:
http://www.furt.com/code/php/com_issues/

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-26 17:12 UTC] grangeway2 at hotmail dot com
I produced this with 4.1.1 and the shorter script of :
  $excel = new COM("Excel.Application");

  $excel->application->DisplayAlerts = "False";
  $excel->Quit();
  $excel->Release();
  $excel=null;

In the current development cvs version ( 4.3.0-dev 26/04/02), once the script execution is complete excel appears to be closed correctly. 
(maybe http://cvs.php.net/co.php/php4/ext/com/com.h?r=1.11 was the cvs fix for this?)
 [2002-04-27 06:15 UTC] phanto@php.net
yes. i only wasn't able to test it thus i left the bugreport open. but seems you are quicker than i am ;)
 [2002-11-15 06:36 UTC] albert at chilledbeats dot org
Tested this (stripped) script on PHP 4.2.3 and 4.3.0pre2 under a Windows 2000 Advanced server with IIS and ISAPI interface:
---
$excel = new COM("Excel.Application");

$excel->Workbooks->open("sales.xls");
$book = $excel->ActiveWorkbook;

$cell = $excel->ActiveWorkbook->Worksheets[1]->Cells(1,1); // *
$cell->Activate(); // *
$cell->Value = "Debug-Test"; // *

$book->saveas("sales2.xls");

$book->Close();
unset($book);

$excel->Quit();
$excel->Release();
unset($excel);
---

Running this script will cause Excel to stay in memory on the server and has to be removed manually. Commenting the lines ending with the asterisk will prevent this (but makes this script useless).

I've tried many different ways to accomplish this task, for example:
$sheet = $excel->ActiveWorkbook->Worksheets(1);
$cell = $sheet->Cells(1,1);
instead of
$cell = $excel->ActiveWorkbook->Worksheets[1]->Cells(1,1);

Or, changing another element of the worksheet, like the title. Or, creating a new sheet and entering data in that one. All resulted in a hanging Excel in memory.
It seems to come down to changing something in the worksheet object, which is messing something up internally.

This also seems to have something to do with bug #19156. I haven't downloaded the latest snapshot, but I'm assuming that that bugfix is in 4.3.0pre2.

So... Please reopen this bug, I don't think it's fixed yet.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 15:01:32 2024 UTC