Look at the link.
http://prefetch.net/blog/index.php/2007/01/02/measuring-apache-request-processing-time/
It shows how to configure apache to record the time the request receives apache.
Then you can use the apache_request_headers foundation in PHP and extract the time from it.
http://php.net/manual/en/function.apache-request-headers.php
Perhaps this way you can figure out the time between when apache starts receiving the file and when it passes processing to php?
You might need to do some testing as I have not tried this. Let me know if this works ... :)
UPDATE @GustavBertram :
Note. I edited the answer instead of my own question, as I want to document the attempt separately for each answer.
I enabled mod_headers in Apache and added the following configuration file:
#/etc/apache2/mods-available/headers.conf RequestHeader set X-Request-Received: %t
Then I updated my script:
<form action="#" enctype="multipart/form-data" method="post"> Upload:<input type="file" name="datafile" size="40"> <input type="submit" value="Send"> </form> <?php // Get the request headers $REQUEST_HEADERS = apache_request_headers(); // Extract $t value from header parse_str($REQUEST_HEADERS['X-Request-Received']); // Massage string to get float in seconds $received_time = substr_replace($t, '.', 10, 0); // Get the current microtime as float in seconds $current_time = microtime(1); $upload_time = $current_time - $received_time; echo $received_time . " \n <BR />"; echo $current_time . " \n <BR />"; echo $upload_time;
I tested it both on my local computer and on a remote computer on the network, with a file of 700 MB.
source share