From: gregor at hostgis dot com Operating system: Linux PHP version: 5.2.9 PHP Bug Type: Performance problem Bug description: shell_exec() is much slower than running from shell
Description: ------------ Commands executed via shell_exec() take a lot longer to run than when run directly from the Unix shell. In the example code below, a task that takes 0.5-0.7 seconds takes 5 seconds. This effect is reliable, and a given task's "how much longer it takes than it should" ratio seems constant. In the simple case below, it takes 8-10 times longer than it should. For a specific more complex test case at our side, the task consistently takes 14 seconds from shell and 83 seconds from shell_exec() This effect is apparently identical for the entire family of process-handling functions: passthru, exec, shell_exec, and popen all show the exact same "slowness multipliers" as described above. This report may be similar to http://bugs.php.net/bug.php?id=15746 However, this is for Linux systems and not specific to Windows NT or NETPBM. Reproduce code: --------------- <?php // gdal_translate converts GIS data // in this case, simply copy a GeoTIFF with no transforms $command = 'gdal_translate /tmp/in.tif /tmp/out.tif'; $t0 = microtime(true); exec($command); $t1 = microtime(true); printf("%.1f seconds", $t1 - $t0); ?> Expected result: ---------------- When run from the shell, this takes 0.5 to 0.7 seconds. Actual result: -------------- This takes 5.0-5.5 seconds. -- Edit bug report at http://bugs.php.net/?id=48403&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48403&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48403&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48403&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48403&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48403&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48403&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48403&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48403&r=needscript Try newer version: http://bugs.php.net/fix.php?id=48403&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48403&r=support Expected behavior: http://bugs.php.net/fix.php?id=48403&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48403&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48403&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48403&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48403&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=48403&r=dst IIS Stability: http://bugs.php.net/fix.php?id=48403&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48403&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48403&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48403&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48403&r=mysqlcfg
