tags:

views:

47

answers:

1

Hi overflowers!!

Hope you help me... I've been at this for the past 2 days and have to admit that I'm stumped.

The OS I'm on is Ubuntu 9.10 Karmic.

I successfully installed and tested Mapserver. For my class project, I have a php script that I am using to create a layer see below....

The error I get when run the script on a cmd line prompt:

Warning: [MapServer Error]: msProcessProjection(): no system list, errno: 2

 in /var/www/mapserverdocs/ms4w/apps/world/mapscripts/staticwms.php on line 16

Warning: Failed to open map file static.map in /var/www/mapserverdocs/ms4w/apps/world/mapscripts/staticwms.php on line 16

Fatal error: Call to a member function owsdispatch() on a non-object in /var/www/mapserverdocs/ms4w/apps/world/mapscripts/staticwms.php on line 18

PHP SCRIPT:

<?php

if (!extension_loaded("MapScript")) dl("php_mapscript");

$request = ms_newowsrequestobj();

foreach ($_GET as $k=>$v) {
  $request->setParameter($k, $v);
}

$request->setParameter("VeRsIoN","1.0.0");

ms_ioinstallstdouttobuffer();

$oMap = ms_newMapobj("static.map");
$oMap->owsdispatch($request);

$contenttype = ms_iostripstdoutbuffercontenttype();

if ($contenttype == 'image/png') {    
  header('Content-type: image/png');
  ms_iogetStdoutBufferBytes();
} else {
  $buffer = ms_iogetstdoutbufferstring();
  echo $buffer;
}

ms_ioresethandlers();

?>

I made the directory and files world wide rwx just to make sure it was not a permissions issue

Any help would be greatly appreciated!!

Thanks

Chris

A: 

As meagar said, the issue is probably that this line:

$oMap = ms_newMapobj("static.map");

is unable to find "static.map". The current working directory of PHP is very often not what you'd expect it to be. Try making the path be relative to the current script. If static.map is in the same directory as static.map, try this code:

$mapPath = dirname(__FILE__).'/static.map';
$oMap = ms_newMapobj($mapPath);
$oMap->owsdispatch($request);

if static.map is at, let's say, /var/www/mapserverdocs/ms4w/apps/world/mapfiles/static.map, then try:

$mapPath = dirname(__FILE__).'/../static.map';
$oMap = ms_newMapobj($mapPath);
$oMap->owsdispatch($request);

Notice the */../*static.map. dirname(__FILE__) will return the name of the directory of the PHP file you place that code in.

Josh
Thanks for the replies... I started everything for scratch and I no longer get the error
Chris