Problem with PHP MapScript Wrappers for WxS Services
Ben Tuttle
funkbucket at GMAIL.COM
Mon Nov 27 18:31:09 PST 2006
Hi all-
I am trying to get the MapScript Wrappers for WxS Services working
with PHP. I am running mapserver 4.10.0 on a linux server with PHP
4.3.9 (this is not built from source, it is the default redhat build,
not sure if this matters). I am tryin gto start by implementing the
examples at http://mapserver.gis.umn.edu/docs/howto/wxs_mapscript
However, I can't even get the fisrt example (the get capabilites
example) to function properly. I have been able to track down when it
fails. It seems to load the mapscript libray okay and create the
request object ($request = ms_newowsrequestobj();). However, it seems
that the requst object comes back empty despite parameters being
supplied with the URL. The URL I am using, the php code, and the
output are below. Any thoughts on what might be wrong here would be
greatly appreciated. In my php script everything starting at and after
the line $request->loadparams(); is commented out, becuase it fails
when I try to use loadparams(), I am guessing because numparams in
$request is 0.
By the way at present this server is not avaialable to the public
until it gets cleared by our IT guys as being secure. However, I'd be
happy to provide more info if it might help solve problem. Hopefully
we'll be open to the public soon.
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Example URL:
http://eogmaps.ngdc.noaa.gov/test4.php?service=WMS&version=1.1.1&Request=GetCapabilities
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
PHP Script:
<?php
dl("php_mapscript.so");
$request = ms_newowsrequestobj();
print "<br><b>Dump of request: </b>";
var_dump($request);
print "<br><b>Num Params: </b>";
echo $request->numparams;
echo $request->getname(1);
echo "<br><br><b>Environment Variables from HTTP_ENV_VARS</b><br><br>";
reset($HTTP_ENV_VARS);
while (list ($key, $val) = each ($HTTP_ENV_VARS)) {
print $key . " = " . $val . "<br>";
};
echo "<br><b>Environment Variables from HTTP_SERVER_VARS</b><br><br>";
reset($HTTP_SERVER_VARS);
while (list ($key, $val) = each ($HTTP_SERVER_VARS)) {
print $key . " = " . $val . "<br>";
};
/*
$request->loadparams();
$request->setParameter("VeRsIoN","1.1.0");
ms_ioinstallstdouttobuffer();
$oMap = ms_newMapobj("/mnt/anchor1/eogmaps/data/dmsp1.map");
$oMap->owsdispatch($request);
$contenttype = ms_iostripstdoutbuffercontenttype();
$buffer = ms_iogetstdoutbufferstring();
header('Content-type: application/xml');
echo $buffer;
ms_ioresethandlers();
*/
?>
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Output From the script:
Dump of request: object(ms_cgirequest_obj)(2) { ["_handle_"]=>
resource(2) of type (Unknown) ["numparams"]=> int(0) }
Num Params: 0
Environment Variables from HTTP_ENV_VARS
LANG = C
TERM = xterm-color
PATH = /sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
PWD = /
SHLVL = 1
_ = /sbin/initlog
Environment Variables from HTTP_SERVER_VARS
Host =
HTTP_HOST = eogmaps.ngdc.noaa.gov
HTTP_USER_AGENT = Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US;
rv:1.8.0.8) Gecko/20061025 Firefox/1.5.0.8
HTTP_ACCEPT = text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
HTTP_ACCEPT_LANGUAGE = en-us,en;q=0.5
HTTP_ACCEPT_ENCODING = gzip,deflate
HTTP_ACCEPT_CHARSET = ISO-8859-1,utf-8;q=0.7,*;q=0.7
HTTP_KEEP_ALIVE = 300
HTTP_CONNECTION = keep-alive
HTTP_CACHE_CONTROL = max-age=0
PATH = /sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
SERVER_SIGNATURE =
Apache/2.0.52 (Red Hat) Server at eogmaps.ngdc.noaa.gov Port 80
SERVER_SOFTWARE = Apache/2.0.52 (Red Hat)
SERVER_NAME = eogmaps.ngdc.noaa.gov
SERVER_ADDR = 141.174.183.20
SERVER_PORT = 80
REMOTE_ADDR = 141.174.183.3
DOCUMENT_ROOT = /mnt/anchor1/eogmaps/www/html/
SERVER_ADMIN =
SCRIPT_FILENAME = /mnt/anchor1/eogmaps/www/html/test4.php
REMOTE_PORT = 56757
GATEWAY_INTERFACE = CGI/1.1
SERVER_PROTOCOL = HTTP/1.1
REQUEST_METHOD = GET
QUERY_STRING = service=WMS&version=1.1.1&Request=GetCapabilities
REQUEST_URI = /test4.php?service=WMS&version=1.1.1&Request=GetCapabilities
SCRIPT_NAME = /test4.php
PHP_SELF = /test4.php
PATH_TRANSLATED = /mnt/anchor1/eogmaps/www/html/test4.php
argv = Array
argc = 1
More information about the MapServer-users
mailing list