Maybe I should write a function disable all open file descriptors instead,
since traditionally that's how it is done. However, I thought PHP closes
STDIN after it's initial read - but I might be wrong.


"Patrick O'Lone" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hey PHP developers!
>
> I wrote function to disable STDOUT from the PHP binary. It just sets the
> php_output_set_status() flag option to disable output. However, I don't
know
> if PHP continues to buffer the output somewhere. Does anyone know? BTW -
> I've written this function because I want to write a daemon using PHP, but
> initiating a fork'd process from a TTY still causes PHP to deliver output
to
> the STDOUT. It's true, I could be more "unix-y" about the situation and
do:
> "php script.php &>/dev/null", but I'd rather be lazy and just type "php
> script.php" and let it daemonize properly. In addition, I know think this
> disassociates the TTY from STDERR - so runtime errors may still be
> generated.
>
>
> PHP_FUNCTION(ob_disable_stdout)
> {
>    zval **zv_flag;
>    int flag;
>
>    switch(ZEND_NUM_ARGS()) {
>
>        case 0:
>             flag = 0;
>             break;
>
>        case 1:
>             if (zend_get_parameters_ex(1, &zv_flag) == FAILURE) {
>                RETURN_FALSE;
>             }
>             convert_to_long_ex(zv_flag);
>             flag = Z_LVAL_PP(zv_flag);
>             break;
>
>        default:
>             WRONG_PARAM_COUNT;
>             break;
>
>     }
>
>     php_output_set_status(flag);
>
> }
> /* }}} */
>
>



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to