ID:               15746
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Open
 Bug Type:         Performance problem
 Operating System: Windows 2000 Server
 PHP Version:      4.1.1
 New Comment:

This is a frequently reported problem on the Gallery Users mailing list
(http://gallery.sourceforge.net/)


Previous Comments:
------------------------------------------------------------------------

[2002-02-26 22:29:22] [EMAIL PROTECTED]

Summary:

Running a PHP script which calls exec() from withing Apache runs
terribly slow or times out.  Running same from the command prompt
returns in seconds.

Details:
I (and other NT users) have run into performance issues running PHP
4.1.1 with the NETPBM distribution.    When running thumbnailing
operations via. webpages, the performance (throughtput) of the system
is dismal.

Running the same PHP script manually from the command shell completes
operations in under a second which usually timeout when executed from a
webpage.

A full "ready to run" repro of this problem is available via. a small
ZIP file at http://www.green-bean.com/bugfiles/slowrepro.zip.;   This
contains the required NETPBM files.   If these are already installed on
your system, you can run the script below with slight modifications.

Thanks,
Nigel.
----
Repro:

<?
// Full repro kit including executables available from
http://www.green-bean.com/bugfiles/slowrepro.zip
//

// Location of your NETPBM distribution
// We're using
http://prdownloads.sourceforge.net/gallery/netpbm1.1-gallery1.0-win32.tgz
// 
$pbmroot = "netpbm";

// JPG input file (from
http://www.green-bean.com/DallasChristmasHat.jpg)
$file = "DallasChristmasHat.jpg";


function fs_exec($cmd, &$results, &$status, &$time) {
    // We can't redirect stderr with Windows.  Hope that we won't need
to.
    $time_st = time();
    $x = exec("$cmd", $results, $status);
    $time = time() - $time_st;
}

$quiet = "-quiet";

// JPEG to PNM
$cmd_to_pnm    = "$pbmroot\\jpegtopnm $quiet $file > out\\$file.pnm";

print "<br>Exec: $cmd_to_pnm\n";
fs_exec($cmd_to_pnm, $results, $status, $elapsed);
print "<br>Elapsed: $elapsed secs\n<br>Status: $status";

// PNM to scaled PNM
$cmd_scale_pnm = "$pbmroot\\pnmscale  $quiet -xysize 150 150
out\\$file.pnm > out\\$file.scale.pnm";

print "<br>Exec: $cmd_scale_pnm\n";
fs_exec($cmd_scale_pnm, $results, $status, $elapsed);
print "<br>Elapsed: $elapsed secs\n<br>Status: $status";

// PNM scaled to JPG
$cmd_to_jpg    = "$pbmroot\\ppmtojpeg $quiet out\\$file.scale.pnm
--quality=150 > out\\tn_$file";

print "<br>Exec: $cmd_to_jpg\n";
fs_exec($cmd_to_jpg, $results, $status, $elapsed);
print "<br>Elapsed: $elapsed secs\n<br>Status: $status";

?>

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=15746&edit=1

Reply via email to