From:             [EMAIL PROTECTED]
Operating system: windows 2000
PHP version:      4.1.2
PHP Bug Type:     Reproducible crash
Bug description:  PHP hangs running WZZIP in some circumstances

BUG REPORT - WZZIP or PHP?

Charles palmer, DSP Design, [EMAIL PROTECTED], 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       [EMAIL PROTECTED]  

 

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.
?>
-- 
Edit bug report at http://bugs.php.net/?id=16226&edit=1
-- 
Fixed in CVS:        http://bugs.php.net/fix.php?id=16226&r=fixedcvs
Fixed in release:    http://bugs.php.net/fix.php?id=16226&r=alreadyfixed
Need backtrace:      http://bugs.php.net/fix.php?id=16226&r=needtrace
Try newer version:   http://bugs.php.net/fix.php?id=16226&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=16226&r=support
Expected behavior:   http://bugs.php.net/fix.php?id=16226&r=notwrong
Not enough info:     http://bugs.php.net/fix.php?id=16226&r=notenoughinfo
Submitted twice:     http://bugs.php.net/fix.php?id=16226&r=submittedtwice

Reply via email to