Disable STDOUT
| From: | Patrick O'Lone | Date: | Mon, 08 Jul 2002 05:30:41 +0000 |
| Subject: | Disable STDOUT | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-85827@lists.php.net to get a copy of this message | ||
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);
}
/* }}} */