[Mapserver-users] how to put php code inside a CGI template

BLISS Meredith * DAS CJC Meredith.Bliss at state.or.us
Tue Jul 22 11:42:38 EDT 2003


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C35067.E0D9F5A0
Content-Type: text/plain;
	charset="iso-8859-1"

But depending on what you want to do with PHP, something similar might be
possible. I use PHP to rewrite the template file on the fly with results
from a user query, but the file is written as pure html. Would that do what
you need?
	--Bud

-----Original Message-----
From: woodbri at swoodbridge.com [mailto:woodbri at swoodbridge.com]
Sent: Tuesday, July 22, 2003 4:54 AM
To: mapserver-users; colombo.l
Subject: Re: [Mapserver-users] how to put php code inside a CGI template


Luca,

You can't really do this because it is not the way things work. The 
browser makes a request to the server. The server then handles the 
request by having the appropriate server side application like GCI 
mapserv OR php to process the request. and then it sends the results 
back to the browser.

What you are trying to do is send a request to CGI mapserv to process 
the templates and the send the results to PHP instead of the browser 
to be processed again INSTEAD of sending the results back to the 
browser.

If you want to work in PHP then you should not be using CGI mapserv, 
you need to rebuild your whole application to be written using 
PHP/mapscript.

Hope this helps,
  -Steve W.

On 22 Jul 2003 at 10:00, colombo.l wrote:

> hello,
> 
> i did a CGI-Mapserver application following some tutorials on the
> site, all work great, I have some problems when I put php code inside
> my template file. I use apache 2.0.40, php 4.3 (working as a cgi) and
> mapserver 3.6.
> 
> If I define my template.php as my template (inside mapfile) I get some
> errors (Malformed URL). So I added this line to http.conf:
> 
> AddType application/x-httpd-php .html
> 
> Now I can put php code inside html pages, but it didn't works with
> mapserver !!
> 
> I can't get the php-code to be compiled, mapserver process the page
> but apache+php didn't.
> 
> What can I do?
> I really need help.
> 
> thank's to all
> 
> Luca Colombo
> 

_______________________________________________
Mapserver-users mailing list
Mapserver-users at lists.gis.umn.edu
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users

------_=_NextPart_001_01C35067.E0D9F5A0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2653.12">
<TITLE>RE: [Mapserver-users] how to put php code inside a CGI =
template</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2>But depending on what you want to do with PHP, =
something similar might be possible. I use PHP to rewrite the template =
file on the fly with results from a user query, but the file is written =
as pure html. Would that do what you need?</FONT></P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>--Bud</FONT>
</P>

<P><FONT SIZE=3D2>-----Original Message-----</FONT>
<BR><FONT SIZE=3D2>From: woodbri at swoodbridge.com [<A =
HREF=3D"mailto:woodbri at swoodbridge.com">mailto:woodbri at swoodbridge.com</=
A>]</FONT>
<BR><FONT SIZE=3D2>Sent: Tuesday, July 22, 2003 4:54 AM</FONT>
<BR><FONT SIZE=3D2>To: mapserver-users; colombo.l</FONT>
<BR><FONT SIZE=3D2>Subject: Re: [Mapserver-users] how to put php code =
inside a CGI template</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>Luca,</FONT>
</P>

<P><FONT SIZE=3D2>You can't really do this because it is not the way =
things work. The </FONT>
<BR><FONT SIZE=3D2>browser makes a request to the server. The server =
then handles the </FONT>
<BR><FONT SIZE=3D2>request by having the appropriate server side =
application like GCI </FONT>
<BR><FONT SIZE=3D2>mapserv OR php to process the request. and then it =
sends the results </FONT>
<BR><FONT SIZE=3D2>back to the browser.</FONT>
</P>

<P><FONT SIZE=3D2>What you are trying to do is send a request to CGI =
mapserv to process </FONT>
<BR><FONT SIZE=3D2>the templates and the send the results to PHP =
instead of the browser </FONT>
<BR><FONT SIZE=3D2>to be processed again INSTEAD of sending the results =
back to the </FONT>
<BR><FONT SIZE=3D2>browser.</FONT>
</P>

<P><FONT SIZE=3D2>If you want to work in PHP then you should not be =
using CGI mapserv, </FONT>
<BR><FONT SIZE=3D2>you need to rebuild your whole application to be =
written using </FONT>
<BR><FONT SIZE=3D2>PHP/mapscript.</FONT>
</P>

<P><FONT SIZE=3D2>Hope this helps,</FONT>
<BR><FONT SIZE=3D2>&nbsp; -Steve W.</FONT>
</P>

<P><FONT SIZE=3D2>On 22 Jul 2003 at 10:00, colombo.l wrote:</FONT>
</P>

<P><FONT SIZE=3D2>&gt; hello,</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; i did a CGI-Mapserver application following =
some tutorials on the</FONT>
<BR><FONT SIZE=3D2>&gt; site, all work great, I have some problems when =
I put php code inside</FONT>
<BR><FONT SIZE=3D2>&gt; my template file. I use apache 2.0.40, php 4.3 =
(working as a cgi) and</FONT>
<BR><FONT SIZE=3D2>&gt; mapserver 3.6.</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; If I define my template.php as my template =
(inside mapfile) I get some</FONT>
<BR><FONT SIZE=3D2>&gt; errors (Malformed URL). So I added this line to =
http.conf:</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; AddType application/x-httpd-php .html</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; Now I can put php code inside html pages, but =
it didn't works with</FONT>
<BR><FONT SIZE=3D2>&gt; mapserver !!</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; I can't get the php-code to be compiled, =
mapserver process the page</FONT>
<BR><FONT SIZE=3D2>&gt; but apache+php didn't.</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; What can I do?</FONT>
<BR><FONT SIZE=3D2>&gt; I really need help.</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; thank's to all</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
<BR><FONT SIZE=3D2>&gt; Luca Colombo</FONT>
<BR><FONT SIZE=3D2>&gt; </FONT>
</P>

<P><FONT =
SIZE=3D2>_______________________________________________</FONT>
<BR><FONT SIZE=3D2>Mapserver-users mailing list</FONT>
<BR><FONT SIZE=3D2>Mapserver-users at lists.gis.umn.edu</FONT>
<BR><FONT SIZE=3D2><A =
HREF=3D"http://lists.gis.umn.edu/mailman/listinfo/mapserver-users" =
TARGET=3D"_blank">http://lists.gis.umn.edu/mailman/listinfo/mapserver-us=
ers</A></FONT>
</P>

</BODY>
</HTML>
------_=_NextPart_001_01C35067.E0D9F5A0--



More information about the mapserver-users mailing list