You are here: Re: detect bytes written on abort « PHP Programming Language « IT news, forums, messages
Re: detect bytes written on abort

Posted by Shailesh Humbad on 10/07/56 11:36

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.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация