php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57259 hash_file: script times out long befor reaching max. execution time
Submitted: 2006-09-25 11:02 UTC Modified: 2013-10-15 11:54 UTC
From: pavel dot stratil-jun at fenix dot cz Assigned:
Status: No Feedback Package: hash (PECL)
PHP Version: 5.1.6 OS: gentoo (amd64smp)
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2006-09-25 11:02 UTC] pavel dot stratil-jun at fenix dot cz
Description:
------------
when trying to hash large files (cant say yet how large, but a 800MB file was hashed without problems but a 1300MB file not), the script times out after about 1 minute even if max. execution time is set to half an hour. smaller files, such as the 800MB file were successfully hashed a few times using different hashing methods (in total the script took about 4 minutes to run).

Reproduce code:
---------------
// tried both:

    $fp = fopen('file.ext', "r");
    $ctx = hash_init('sha512');
    while (!feof($fp)) {
        hash_update($ctx, fgets($fp,$bytes));
    }
    $res_hash = hash_final($ctx);  // this would be line 58
    fclose($fp);

// and

    hash_file('sha512', 'file.ext'); // this would be line 67

// $bytes were set to anywhere from 4kB to 32MB.. same result all the time

Expected result:
----------------
obviously, a hash.

Actual result:
--------------
Fatal error:  Maximum execution time of 1800 seconds exceeded in /opt/apache/htdocs/hashtest.php on line 58.

or

Fatal error:  Maximum execution time of 1800 seconds exceeded in /opt/apache/htdocs/hashtest.php on line 67.

depending what piece of code was commented.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-10-01 15:11 UTC] mike@php.net
-Status: Open +Status: Feedback
 [2013-10-01 15:11 UTC] mike@php.net
Please try using this snapshot:

  http://snaps.php.net/php-trunk-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2013-10-15 11:54 UTC] pecl-dev at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Jan 21 06:01:23 2020 UTC