On Wed, 23 Jun 2004, Michael Austin wrote:
David Van Horn wrote:
As a shell script, the following program works as expected.
---------------------------------------
#! /usr/bin/sh
echo '<html><? print 1 ?></html>' | php
---------------------------------------
However, when run as a CGI script, invoking php causes the php
interpreter to load the current file (ie, the sh script), which
obviously is ga ga.
How can I supress this behavior of interpreting the current file when
invoking PHP in a CGI script?
Thanks,
David
<clip>
echo '<htm> 1 </html>';
This uses one program to execute the same thing not 2 and is less
resource intensive.
obviously the example is serving as an example and not what this person
really wants to accomplish. short, precise questions should be
welcomed<http://www.catb.org/~esr/faqs/smart-questions.html#volume>.
it seems there doesn't exist an option to shut off PHP's obsession of
acting with such a large ego.
i can't find in the PHP C code where the interpreter decides to behave
differently depending if it is operating in a HTTP/CGI environment or in a
shell environment at a command-line terminal.
i tried creating an environment for PHP with the env command, but this
only keeps PHP from processing the file (for which it gives a "No input
file specified." error), and doesn't keep it from stealing the show and
responding to the HTTP/CGI request on its own. can't PHP tell something
is waiting at the door on standard input (stdin) and proces it?
---
#!/bin/sh
echo 'Content-type: text/plain'
echo ''
echo '<html><?php echo 1; ?></html>' | (env SCRIPT_FILENAME='' php)
---
/a