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

Tyler Mitchell TMitchell at lignum.com
Thu Feb 28 17:26:02 EST 2002


Ugh...very good point.  No wonder I couldn't find any docs on it! :) (duh)
Now that I think about it, the examples I saw were for javascript - not php
- so it would make sense if javascript was sent to the browser via CGI -
but I had forgot about the need to interpret php before sending to the
browser.

I'm just working on a basic php database application which is currently
written in CGI.  I was hoping to slowly move chunks of it over - but I
guess I don't have that luxury.  I'm not using it for anything related to
mapserver, though I hope to delve into mapscript sometime in the future
with another project.

Thank you Stephen, for clearing that up for me.  But do you know what
function I was looking for?  (i.e. that echo >>> junk in my example)


                                                                                                                     
                    Stephen                                                                                          
                    Woodbridge            To:     Tyler Mitchell <TMitchell at lignum.com>                              
                    <woodbri at swoodb       cc:     mapserver-users at lists.gis.umn.edu                                  
                    ridge.com>            Fax to:                                                                    
                                          Subject:     Re: [mapserver-users] Sorta Off Topic - Putting PHP code in a 
                    02/28/2002             CGI  script?                                                              
                    02:17 PM                                                                                         
                                                                                                                     
                                                                                                                     




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