ScotlandPHP

Voting

Please answer this simple SPAM challenge: three plus two?
(Example: nine)

The Note You're Voting On

kazink at gmail dot com
7 years ago
I had problems running php as CGI in thttpd. I have followed instructions posted by db at digitalmediacreation dot ch, but I was still getting "500 Internal Error" answer from the server. However, I had no problems running php as CLI using a simple wrapper file named index.cgi:

#!/usr/bin/php
<?php
 
require_once 'index.php';
?>

but i needed to pass user data through GET and POST, and this method couldn't handle it. I have spent 2 hours figuring out how to run the CGI mode properly, until I finally gave up, and done it in "manual" way. I have just added some code to the wrapper that reads GET and POST data into the proper variables:

#!/usr/bin/php
<?php

 
//parse the command line into the $_GET variable
 
parse_str($_SERVER['QUERY_STRING'], $_GET);
 
 
//parse the standard input into the $_POST variable
 
if (($_SERVER['REQUEST_METHOD'] === 'POST')
   && (
$_SERVER['CONTENT_LENGTH'] > 0))
  {
   
parse_str(fread(STDIN, $_SERVER['CONTENT_LENGTH']), $_POST);
  }

  require_once
'index.php';
?>

It works well for me. It may be useful if someone else have similar problem.

<< Back to user notes page

To Top