[mapserver-users] Fatal error: Call to a member function setSize() on a non-object

Stefan Schwarzer stefan.schwarzer at grid.unep.ch
Tue Jun 29 05:27:33 PDT 2010


Hi there,

I am about to move my mapserver application from one (old) server to another (new) one. The old one was using mapserver 4.x, the new one the latest version. I copied the files over to the new server, eliminated the "dl("php_mapscript.so")", and in principal, I would have said, it should have worked.

But it doesn't...

It tells me "Fatal error: Call to a member function setSize() on a non-object". This happens on this line: $map -> setSize(900, 450);

The phpinfo file tells me that Mapscript is loaded correctly. So, what can it be?

Thanks for any suggestions!

Stef


Here is the somewhat more complete code:


--------------------------------------------------------------------------------------------------------------------------------------------
	// ---------------------------------------
	// --        set map parameters         --
	// ---------------------------------------

	// set paths
	$map_path = GEO_ROOT_PATH."/../temp/"; 
	$map = ms_newMapObj($map_path.$map_file);

	
	// set maximal map-extent
	$max_extent = ms_newrectObj();

	$max_extent -> setextent(-180, -90, 180, 90);


	// set extension for AJAX script in tpl file
	if (($selectedRegion == "West Asia") && ($imgext == ""))
	{
		$imgext = "14 12 65 55";
	}

	if ($imgext == "") $imgext = "-180 -90 180 90";

	
	$extent_dd = explode(" ", $imgext);
	$tpl -> assign('mapExtent', $extent_dd[0].",".$extent_dd[2].",".$extent_dd[1]);
	

				
	// set map size - either to selected size or to default size
	if ($_POST["mapsize"])
	{
		$size = explode("x", $H_POST["mapsize"]);
		$map -> set("width", $size[0]);
		$map -> set("height", $size[1]);
	}
	else
	{
	   $map -> setSize(900, 450);
	}
--------------------------------------------------------------------------------------------------------------------------------------------






More information about the MapServer-users mailing list