Re: Re: cgi and php

Olhado <[email protected]> Thu, 17 Jun 2004 08:35:38 -0400
Newsgroups gmane.org.ballistichelmet.devel
Message-ID <[email protected]>

* dvanhorn <[email protected]> [2004-06-17 00:36:06 -0400]:

> 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?


  You could try the passthru() command in php?

  http://us4.php.net/passthru

  So, if your file was mkhtml.sh you could do something like 

  passthru(mkhtml.sh);

  But I'm not sure if it will process the php or not after inserting
  it...

-o

> 
> 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
> 
> 
> _______________________________________________
> devel mailing list
> [email protected]
> http://ballistichelmet.org/mailman/listinfo/devel