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

Paul Spencer pagameba at magma.ca
Thu Feb 28 21:04:33 EST 2002


Keep in mind that if you plan on using PHP/MapScript you will need to
use PHP 4.0.6 and configure it as a CGI rather than a loaded module.

Paul Spencer

-----Original Message-----
From: owner-mapserver-users at lists.gis.umn.edu
[mailto:owner-mapserver-users at lists.gis.umn.edu] On Behalf Of
Antti.Roppola at brs.gov.au
Sent: Thursday, February 28, 2002 6:20 PM
To: TMitchell at lignum.com; mapserver-users at lists.gis.umn.edu
Subject: RE: [mapserver-users] Sorta Off Topic - Putting PHP code in a
CGI script?


You'd be better off calling your code from inside PHP
if you really needed it. PHP is usually set up as a
module in your server, so it's probably going to be
respond faster than a CGI.

As for the database, you could excise the CGI specifics
in your database and call them from inside PHP as functions. Later on,
you could re-write each function as native PHP. I do this to keep all
database specific stuff out of my apps:

function select_old ($sql) {
	system(myoldcgoappmodified "$sql");
	... stuff happens...
	return $result;
}

function select($sql, $link) {
	if (!($result = mysql_query($sql,$link))) {
		echo("SQL query failed: $sql from $link<BR>\n");
	}
	return $result;
}

Antti

-----Original Message-----
From: Tyler Mitchell [mailto:TMitchell at lignum.com]
Sent: Friday, 1 March 2002 8:10 AM
To: mapserver-users at lists.gis.umn.edu
Subject: [mapserver-users] Sorta Off Topic - Putting PHP code in a CGI
script?


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