Bug #15746 Updated: Process exec() is slow from webserver - running from shell is ok ...
| From: | wez@php.net | Date: | Thu, 23 May 2002 10:22:21 +0000 |
| Subject: | Bug #15746 Updated: Process exec() is slow from webserver - running from shell is ok ... | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-8309@lists.php.net to get a copy of this message | ||
ID: 15746
Updated by: wez@php.net
Reported By: nigel@green-bean.com
Status: Feedback
Bug Type: Performance problem
Operating System: Windows 2000 Server
PHP Version: 4.1.1
New Comment:
By the way: PHP doesn't do anything any different (with regards to
executing files) if it is running as a module or as a cgi. Does perl
have a similar issue?
Previous Comments:
------------------------------------------------------------------------
[2002-05-23 06:10:58] wez@php.net
Could one of you guys try a CVS snapshot and alter the scripts to use
the new proc_open function?
It's possible that it might have better performance,
(and you can then redirect stderr too!)
------------------------------------------------------------------------
[2002-05-23 02:09:13] dj_TOW@gmx.net
hi all,
just wanted to add to this:
im running windows 2000 (german), apache 1.3.24 with php 4.2.1.
(php4apache.dll). i have the same issue described above, with netpbm
just timing out, even when trying to do a simple "-version" in a
script. since i need to use netpbm for a gallery i run (which ran fine
on omnihttpd btw), i would like to know if there is a workaround, or if
this bug will be fixed anytime soon.
------------------------------------------------------------------------
[2002-02-28 14:24:11] bharat@menalto.com
This is a frequently reported problem on the Gallery Users mailing list
(http://gallery.sourceforge.net/)
------------------------------------------------------------------------
[2002-02-26 22:29:22] nigel@green-bean.com
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