php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46339 exec('php -l my_file.php'); takes over 5 seconds to run
Submitted: 2008-10-19 06:25 UTC Modified: 2008-10-19 14:07 UTC
From: amanank at yahoo dot com Assigned:
Status: Not a bug Package: Performance problem
PHP Version: 5.2.6 OS: Windows 2000
Private report: No CVE-ID: None
 [2008-10-19 06:25 UTC] amanank at yahoo dot com
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 :(

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-19 14:07 UTC] jani@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Nov 29 16:01:32 2024 UTC