Re: Re: [SOLVEDish] Re: [PHP] output buffering in CLI script.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Aschwin Wesselius wrote:

Me thinks that when shebang doesn't fit /usr/bin/php (which happens sometimes) you're doomed.....
[snip]
good point.. modified to use BINDIR:

#!/usr/bin/php
<?php
class trimshebang {
  function filter($in, $out, &$consumed, $closing)
  {
    while ($bucket = stream_bucket_make_writeable($in)) {
      $bucket->data = ltrim($bucket->data,"#!".PHP_BINDIR."/php\n");
      $consumed += $bucket->datalen;
      stream_bucket_append($out, $bucket);
    }
    return PSFS_PASS_ON;
  }
}

stream_filter_register("trim.shebang", "trimshebang");
include "php://filter/read=trim.shebang/resource=/path/to/include.php";
?>

But it still is a nice example.

thanks :)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux