Re: detect bytes written on abort
- From: Shailesh Humbad <humbads@xxxxxxxxxxxxxxx>
- Date: Fri, 06 Jan 2006 00:10:56 -0500
Chung Leong wrote:
Shailesh Humbad wrote:Here is an advanced PHP question. Can anyone think of a way to detect the number of bytes written to output when a script is aborted?
If you are using Apache and can recompile the SAPI module, you can add the following function to php_functions.c:
/* {{{ proto integer apache_get_bytes_sent(void) Get the number of bytes actually sent */ PHP_FUNCTION(apache_get_bytes_sent) { php_struct *ctx; ctx = SG(server_context); RETURN_LONG(ctx->r->bytes_sent); } /* }}} */
If TCP/IP guarenteed delivery is to be believed, then that should be the exact number of bytes received (but not necessarily saved) by the client.
Here is my hosting provider's configuration: apache_get_version: Apache/1.3.33 (Debian GNU/Linux) mod_throttle/3.1.2 mod_ssl/2.8.22 OpenSSL/0.9.7d php_sapi_name: apache
I am unfamiliar with PHP internals and how they interact with the web server. Will that only work on Apache 2 and with sapi as "apache2filter" or "apache2handler"? I don't think I can recompile the SAPI module, but I could build my own module and have my hosting provider install it. Is it possible to add such a function in a custom module? If it is too hard, then I will just go the low-tech route (polling the log file).
Thanks. .
- Follow-Ups:
- Re: detect bytes written on abort
- From: Chung Leong
- Re: detect bytes written on abort
- References:
- detect bytes written on abort
- From: Shailesh Humbad
- Re: detect bytes written on abort
- From: Chung Leong
- detect bytes written on abort
- Prev by Date: Re: |OT| Re: immigration to US, UK or CANADA
- Next by Date: Re: detect bytes written on abort
- Previous by thread: Re: detect bytes written on abort
- Next by thread: Re: detect bytes written on abort
- Index(es):
Relevant Pages
|