php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16226 PHP hangs running WZZIP in some circumstances
Submitted: 2002-03-22 17:52 UTC Modified: 2002-06-17 20:58 UTC
From: charles at dspdesign dot com Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 4.1.2 OS: windows 2000
Private report: No CVE-ID: None
 [2002-03-22 17:52 UTC] charles at dspdesign dot com
BUG REPORT - WZZIP or PHP?

Charles palmer, DSP Design, charles@dspdesign.com, 22 March 2002



WZZIP hangs when compressing more than about 16 files when run from within PHP.

(LATER - SEE END OF THIS DOCUMENT!)

I am making use of the WZZIP Command Line Support Add-on (www.winzip.com).

I have been trying to use WZZIP from within PHP, using the PHP exec() command, to compress
files and directories. It works OK until the number of files being compressed exceeds about 16,
in which case the PHP program hangs.

The same WZZIP command works OK when typed directly at a DOS command prompt. It works 
satisfactorily when using the Windows RUN dialog, although there is a (different) bug with that also
(no output.txt file produced - see PHP Source code).

I am using Windows 2000 and PHP 4.1.2 - I have tried both the Version 1.0 and the beta V1.1
versions of WZZIP with the same results.

I attach a copy of the PHP program I am running and the output of the phpinfo() call, 
which reports my PHP configuration.

The PHP program attempts to compress the contents of a directory called C:\junk\test_dir
into a zip file called c:\junk\test.zip, with the output going to a file called 
c:\junk\output.txt. This works when test_dir contains up to abou 16 files, 
but fails beyond that number. In that case, the PHP program hangs
until stopped by typing the browser's STOP button. The Windows Task Manager reports an 
instance of WZZIP.EXE still running, and a file with a name something like "_Za01584" appears 
in the C:\junk directory - it is about the correct size for the zip file, and it cannot be 
deleted until I kill off the WZZIP program by using Windows Task Manager. 
The output.txt file seems to start OK, indicating normal operation, but stops when recording 
the addition of the 16th file (sometimes I can compress 17 files).

If I split the compression process into two halves, (compressing about 8 files called *.txt 
to a file test.zip with one exec() call to WZZIP, followed by compressing about 8 files called *.t
to a different file test2.zip with a second call to exec()) then I still get the hanging -
that is, "something" seems to be adding up, and when the number of files exceeds about 16
the system hangs.

Any ideas?

Regards  - Charles Palmer	charles@dspdesign.com  

 

PS - I HAVE JUST REPEATED THE TESTS COMPRESSING LARGE FILES RATHER THAN SMALL FILES - 
IT LOOKS LIKE THE LIMIT IS REACHED AT FEWER THAN 16 FILES WITH LARGE FILES - SO
THE PROBLEM SEEMS TO BE RELATED TO TOTAL COMPRESSED DATA SIZE, RATHER THAN NUMBERS OF FILES.

(I had hoped to email you my php file, but you don't seem to allow for file attachments, so here is the code:)

<?php
// This PHP program can be used to illustrate the problem whereby the PHP amd/or
// WZZIP hang up when compressing more than about 16 files.

echo '
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>WZZIP test.</TITLE>
</HEAD>
<BODY>

<b>This page allows you to create a zip file. It shells out to WZZIP.
If the totral number of files compressed exceeds about 16 the system hangs. 
It is not clear (to me!) whether the problem lies with PHP or WZZIP.</b><br><br>';

//First let us be sure where we are executing from:

$exec_cmd = 'C:' ;
echo 'Executing this command: <b>'.$exec_cmd.'</b><br>';
echo ('Exec() returns this: <b>'.exec($exec_cmd).'</b><br><br>');
//echo 'Changing directory to c:\junk <br>';
chdir('C:\junk');

// lets check where we are:
$exec_cmd = 'cd ' ;
echo 'Executing this command: <b>'.$exec_cmd.'</b><br>';
echo ('Exec() returns this: <b>'.exec($exec_cmd).'</b><br><br>');

// Now - let us try to compress files - we do this in two passes
// to see if it is the total number of files that is the limit, 
// or the number of files per exec call.
// Compress the *.txt files first.

$exec_cmd = 'wzzip -rp c:\junk\test.zip c:\junk\test_dir\*.txt >c:\junk\\output.txt';
echo 'Executing this command: <b>'.$exec_cmd.'</b><br>';
echo ('Exec() returns this: <b>'.exec($exec_cmd).'</b><br><br>');

// now compress some more files - the *.t files:s

$exec_cmd = 'wzzip -rp c:\junk\test2.zip c:\junk\test_dir\*.t >c:\junk\\output2.txt';
echo 'Executing this command: <b>'.$exec_cmd.'</b><br>';
echo ('Exec() returns this: <b>'.exec($exec_cmd).'</b><br><br>');

echo '</body></html>';

// Note the output of the WZZIP proram goes to the output.txt file. When running the command
// from the Windows Run Dialog box, no output.txt is produced,although the compression
// itslef is OK.
?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-23 14:22 UTC] charles at dspdesign dot com
There is no problem when I use PKZIP instead (www.pkware.com). This doesn't entirely vindicate PHP, but it suggests the fault is more likely to lie with WZZIP than PHP. In the meantime - use PKZIP if you want to zip files and directories (I will!).

There does seem to be an opportunity for a full zip class to run from within PHP - I have not been able to find one.
 [2002-06-17 20:58 UTC] sniper@php.net
Like you yourself pointed out, this is more like problem
in wzzip (whatever that is) than PHP. 


 [2004-01-30 04:44 UTC] david_dylan at hotmail dot com
I have had the same problem with wzzip through Windows Script Host and have seen another report of it through Java.  According to WinZip Support they've looked into this problem but can't find a cause.  But they did provide a workaround, which works in Windows Script Host at least.  Instead of

wzzip ...

use

%comspec% /c wzzip ...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 01 11:01:33 2024 UTC