[mapserver-users] Sorta Off Topic - Putting PHP code in a CGI script?

Stephen Woodbridge woodbri at swoodbridge.com
Thu Feb 28 17:17:48 EST 2002


This doesn't make to much sense based on the way things work in a
webserver regarding cgi or php. Basically php is a cgi like thing and
typically the way cgi-ish things work is they execute a script (be it
perl, php, tcl, and executable or whatever) and the output of the
process is sent back to the browser. So the problem you would have with
your example below is that you could output php code, but it would NOT
get executed because it would be default be sent to the browser and php
has to be executed on the server.

SOoooo, why don't you tell us what you are trying to accomplish from an
application point of view and we or I might be more helpful :)

I am not say that you can't get a cgi script to write a php script and
then trick the broswer into executing it, but this is very convoluted
when probably anything you can do in php you could also do in another
cgi language directly without all the convultions.

-Steve

Tyler Mitchell wrote:
> 
> Hi guys, I'm new to both CGI and PHP, but saw an example somewhere in a CGI
> script that allowed you to enter in raw HTML instead of putting in a
> separate PRINT command for it.  I cannot, for the life of me, find this
> example again though.  I though it would allow me to easy put in PHP stuff
> into my CGI script.
> I thought it went something like this:
> 
> .......
> $query->start_html;
> print "bleh bleh";
> ECHO END >>>>
> <B>This is bold</B>
> <? PHP script stuff ?>
> END <<<<
> $query->end_html;
> 
> Know what I mean?  I don't know what you call this and have searched and
> searched the docs with no avail :(



More information about the mapserver-users mailing list