Ticket #1975 (closed enhancement: fixed)
loadparams doesn't work on linux
| Reported by: | ben.tuttle@… | Owned by: | aboudreault |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.0 release |
| Component: | MapScript | Version: | 4.10 |
| Severity: | minor | Keywords: | |
| Cc: | mapserver@…, dmorissette |
Description (last modified by warmerdam) (diff)
Summary: PHP MapScript? loadparams() does not work with mod_php because it does not receive the cgi environment variables. This is presumably true of other non-cgi environments like mod_python as well. This is basically unfixable, but we should likely offer a corresponding mechanism for mod_php/mod_python scripters to pass in the url to loadparams().
Ben reports:
On a linux server using php ms_newowsrequestobj() seems to return an object with numparams equal to zero. When loadparams() is called it fails. Examples of this are found below. In the script example all code satarting at the loadparams() call is commented out because including the loadparams() line causes the entire script to fail.
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
