From: amanank at yahoo dot com
Operating system: Windows 2000
PHP version: 5.2.6
PHP Bug Type: Performance problem
Bug description: exec('php -l my_file.php'); takes over 5 seconds to run
Description:
------------
I have a problem; I am generating php files on the fly and storing them on
the server; in case the server is out of disk space or for some other
bazaar reason the generated files may get corrupted. So when loading next
time will result in a parse error. In this case I simply want to be able to
catch the parse error and delete the file so that it can be re-generated
next time. I tried exec('php -l my_file.php'); but this takes over 5
seconds to run.
Loading 10's of include files with 1000s of lines of code to generate a
page is a lot faster then checking whether a single file has parse errors.
There must be a better way?
Reproduce code:
---------------
<?php
$time_start = microtime(true);
exec('php -l c:/web/temp/my_file_with_parse_errors.php');
$time_end = microtime(true);
$time = $time_end - $time_start;
echo "took $time seconds to check for parse errors :(\n";
?>
Expected result:
----------------
took 0.0001 seconds to check for parse errors :(
Actual result:
--------------
took 5.345 seconds to check for parse errors :(
--
Edit bug report at http://bugs.php.net/?id=46339&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=46339&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=46339&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=46339&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=46339&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=46339&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=46339&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=46339&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=46339&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=46339&r=support
Expected behavior: http://bugs.php.net/fix.php?id=46339&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=46339&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=46339&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=46339&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46339&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=46339&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=46339&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=46339&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=46339&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=46339&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=46339&r=mysqlcfg