I am playing with PHP as a shell scripting tool and trying to use it for
CGI programming that way. This may seem kinda pointless, seeing that PHP
is _way_ more efficient when being used as an Apache module. However I
need to pass stuff from a database query to another CGI program which
is designed to take ouput from a shell command as input (I can also use
GET to directly pass arguments to this program, but that doesn't work
for larger amounts of data). The problem is this: Running a PHP script
from a shell, as in

#!/usr/local/bin/php -q
<?

$conn = pg_connect("dbname=mpi");

$result = pg_exec($conn, "SELECT id FROM index ORDER BY id;");

$rows = pg_numrows($result);

for ($i=0; $i<$rows; $i++) {

// spit out rows etc . . . .

}

?>

works fine. When I try to call the PHP script from the CGI program, I'll
always get:

X-Powered-By: PHP/4.0.3pl1
Content-type: text/html

No input specified.

The very same happens when I exec the PHP script from a BASH script
which normally generates correct CGI output (I am using the test-cgi
script that comes with Apache).

Just trying to run a very simple PHP script as a CGI program like

#!/usr/local/bin/php

echo "bla"

will _also_ produce the above "No input specified." message.

The http header will appear in spite of the -q parameter when exec'ing
the script from within another CGI program. When runnign the PHP script
"standalone" it will only produce "No input specified.", with or without
-q. I'm stumped.  What input is PHP expecting? It behaves like any
scripting language on the command line but does weird things when http
is involved it seems.

Can anyone enlighten me?

Cheers Frank

-- 
frank joerdens               

archi|me|des      
urbanstr. 116
10967 berlin
germany

e: [EMAIL PROTECTED]  
t: +49 (0)30 69597650
f: +49 (0)30 7864046 
h: http://www.archi-me-des.de

pgp key: http://www.joerdens.de/pgp/frank_joerdens.asc

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to