Re: cgi and php

dvanhorn <[email protected]> Thu, 17 Jun 2004 00:36:06 -0400
Newsgroups gmane.org.ballistichelmet.devel
Message-ID <[email protected]>
dvanhorn wrote:
> A cgi script writes HTML to stdout, but what if I want to emit PHP code.  I
> could just pipe the output through php right?

This won't work.  Eg.

---------------------------------------
#! /usr/bin/sh

echo '<html><? print 1 ?></html>' | php
---------------------------------------

>From the command line this program is peachy.  However when run as a cgi
script, calling php causes the php interpreter to load the current file (ie
the sh script), which obviously is ga ga.

If anyone knows how the above program can be made to work as a cgi script
I'd love to hear about it.

-d