Re: [PHP] Statistics function
On Thu, Mar 15, 2001 at 06:10:43AM -0600, Derek Sivers wrote: > > >the connection will close when you hit cancel but the PHP > >code can continue running if you choose. > > How do you choose to have the PHP script continue even if a browser > leaves/dumps? Check out the ignore_user_abort() function. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Statistics function
On Thursday 15 March 2001 08:34, you wrote: > If you want to get round-trip times including transmission to the user, > you'd need to have some way of getting the user's browser to record a > second request, which introduces a lot of potential variables. Why not simply use "ab" (the benchmarking app that comes with apache)? -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) Pretty cool, the kind of power information technology puts in our hands these days. - Securityfocus on probing 3600 hosts for known problems in 3 weeks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Statistics function
>the connection will close when you hit cancel but the PHP >code can continue running if you choose. Really?!? How do you choose to have the PHP script continue even if a browser leaves/dumps? I've always wanted to do that. Didn't know it was possible. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Statistics function
On 14 Mar 2001 21:39:05 -0800, Lauri Vain <[EMAIL PROTECTED]> wrote: >How does the behind the scenes work by PHP exactly go? Does the PHP thread >remain active so long as the information is sent to the visitor? Or will PHP >parse the code and send it to Apache which will send the data to the user >itself? 1 Apache receives the request and determines that it's a PHP script. 2 PHP parses your code 3 PHP executes your code 4 PHP passes output back to Apache 5 Apache sends output to the browser (optionally through things like SSL) 6 Apache finishes request (e.g. logs it, closes a non-persistent connection) The catch is that steps 4/5 may repeat - this depends on your output buffering setup. PHP can wait and send everything when the script finishes, send output in blocks or send every output from each echo/print immediately. (PHP can also do things like compress that output on the fly, but that's a separate conversation) >The reason that I'm asking this is I'm writing a statistics add-on for one of >my sites and was wondering whether the code below would give the time in >which PHP parses the code or in which the data gets streamed to the user. You'd get the time needed to read the file and either send it or add it to the output buffer (depending on your output buffer config as mentioned above). By the time your code is executed, PHP will have already parsed your script (with the exception of things like conditional / variable include()s and require()s), so you'd only get the time required to execute the code, not parse it. If you want to get round-trip times including transmission to the user, you'd need to have some way of getting the user's browser to record a second request, which introduces a lot of potential variables. It might be interesting to see how something relying entirely on client-side calculation like the code below would compare with other approaches (e.g. Header("Location: measure.php?start=" . time()) where measure.php just does $elapsed = time() - $start). It should remove almost all of the server-side latency and, in theory, would give some reasonable indication of how long it takes to transfer a file over the intermediate network connection, which would give you a reasonable idea of available bandwidth. (Disclaimer: completely untested code written just now which has never been seen by anything other than vi. Caveat programmer.) Start = new Date(); function record_elapsed() { Now = new Date(); Elapsed = Now.getTime() - Start.getTime(); recordTimeImg = new Image(); recordTimeImg = "recorder.php?Elapsed=" + Elapsed; } ... a fair amount of text / HTML ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Statistics function
On 14 Mar 2001 22:11:10 -0800, Rick St Jean <[EMAIL PROTECTED]> wrote: >All through this process there is a live thread between your browser and >the server. >unless you send a cancel. One minor addition - the connection will close when you hit cancel but the PHP code can continue running if you choose. This can be quite handy if you want to make sure your code can finish running or clean up nicely before quitting. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Statistics function
Here is what happens... I am skipping a few steps here and there etc.. you type url and run. the broswer finds the server... the server looks at he extension of the document and sends the page to the php engine. The engine parses through the doc, writing to the buffer (unless told to stream info) The page is completed... the engine returns an ok to the server.. the server then dumps the buffer out to the browser. All through this process there is a live thread between your browser and the server. unless you send a cancel. Rick At 07:40 AM 3/15/01 +0200, Lauri Vain wrote: >Hello everybody, > >How does the behind the scenes work by PHP exactly go? Does the PHP thread >remain active so long as the information is sent to the visitor? Or will PHP >parse the code and send it to Apache which will send the data to the user >itself? > >The reason that I'm asking this is I'm writing a statistics add-on for one >of my >sites and was wondering whether the code below would give the time in >which PHP >parses the code or in which the data gets streamed to the user. > > $time_one = microtime(void); > fpassthru($file); > $time_two = microtime(void); > // + here will be the code to calculate the difference > //betweeen $time_one and $time_two > >Would I get information about my server (parsing time) or would I get some >information about the requesters internet connection (how fast will my >files get >to the user). Both would be pretty important! > >PS What are the advanced statistics programs out there? I wouldn't mind >seeing >a sample report (any commercial or non-commercial). > >Thanks in advance in advance! > >Yours, >Lauri > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] ## # Rick St Jean, # [EMAIL PROTECTED] # President of Design Shark, # http://www.designshark.com/ # Quick Contact: http://www.designshark.com/messaging.ihtml # Tel: 905-684-2952 ## -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Statistics function
Hello everybody, How does the behind the scenes work by PHP exactly go? Does the PHP thread remain active so long as the information is sent to the visitor? Or will PHP parse the code and send it to Apache which will send the data to the user itself? The reason that I'm asking this is I'm writing a statistics add-on for one of my sites and was wondering whether the code below would give the time in which PHP parses the code or in which the data gets streamed to the user. $time_one = microtime(void); fpassthru($file); $time_two = microtime(void); // + here will be the code to calculate the difference //betweeen $time_one and $time_two Would I get information about my server (parsing time) or would I get some information about the requesters internet connection (how fast will my files get to the user). Both would be pretty important! PS What are the advanced statistics programs out there? I wouldn't mind seeing a sample report (any commercial or non-commercial). Thanks in advance in advance! Yours, Lauri -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]