|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-10-19 14:07 UTC] jani@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 08 01:00:01 2025 UTC |
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 :(