PHP 8.4.24 Released!

Voting

: max(zero, nine)?
(Example: nine)

The Note You're Voting On

steve dot robinson at frogneck dot com
19 years ago
If you are trying to use exec to run a cgi and output the contents via a php file, headers need to be seperated from the content and output seperately.

Also, at least in the case of the cgi I was attempting to execute, line feeds were missing, and some javascript didn't work as a result, so you may have to add line feeds back into the resulting output.  Here is the code I used to output my cgi properly...

<?PHP
putenv('REQUEST_METHOD=GET');

// to get your parameters passed into the cgi..
putenv('QUERY_STRING=' . $_SERVER['QUERY_STRING']);

//you will know you are past the header when you
//hit a blank line ('')
$inheader=true;
foreach($output as $val){
        if($val=='')
                $inheader=false;  
        if($inheader)
                header($val);
        else
                echo($val . "\n"); // output contents
}
?>

<< Back to user notes page

To Top