[ms4w-users] php file error

Jeff McKenna jmckenna at gatewaygeomatics.com
Tue Mar 10 11:06:58 EST 2009


Aneela wrote:
> Hello everyone! In ms4w  5.2.1, I created & saved the following file as 
> phpms_hello.php
> <?php
>    // Create a unique image name every time through
>    $image_name = sprintf("phpms_hello%0.6d",rand(0,999999)).".jpg";
>    // Create a new instance of a map object
>    $map = ms_newMapObj("/ms4w/Apache/htdocs/hello.map");
>    // Create an image of the map and save it to disk
>    $image=$map->draw();
>    $image->saveImage("/ms4w/tmp/ms_tmp/".$image_name);
> ?>
> <html>
> <head><title>PHP Mapscript Hello World</title></head>
> <body>
>      <form action="phpms_hello.php"  method="POST">
>          <input  type="image" name="img"
>                    src="/ms_tmp/<?php echo $image_name; ?>">
>      </form>
> </body>
> </html>
> When I run this file in the browser,  I get the following error message, 
> Fatal error: Call to undefined function ms_newMapObj() 
> in C:\ms4w\Apache\htdocs\phpms_hello.php on line 5**
> ** 
> N.B: The hello.map file works through an html file. Can anyone help?
> 

Hello,

You need to load the mapscript module.  You can see an example in: 
/ms4w/Apache/htdocs/quickmap.php

-jeff

-- 
Jeff McKenna
FOSS4G Consulting and Training Services
http://www.gatewaygeomatics.com/





More information about the ms4w-users mailing list