I have a PHP script that is loaded by JS via jQuery $.ajax . I measured the runtime of a PHP script using:
$start = microtime(); // top most part of code // all other processes that includes AES decryption $end = microtime(); // bottom part of code file_put_contents('LOG.TXT','TIME IT TOOK: '.($end-$start)."\n",FILE_APPEND);
It is measured somewhere less than 1 second. There are no scripts to add / add PHP.
In JS $.ajax I measured the runtime:
success: function(response) { console.log(date('g:i:s a') + ' time received\n');
The time will be the same for the received time and the processed time.
However, when I check the Chrome Developer Tools , it claims that the PHP script has been loaded for about 8 seconds .
What could be wrong with the way I measured these things? I'm sure PHP loads quickly, but why does Chrome report that it took more than 8 seconds?
I use localhost and my web server is fast and this is the only time I have encountered this problem. All other AJAX calls are quick.
source share