[mapserver-users] php fails on MS4W and Apache

Jeff McKenna jmckenna at gatewaygeomatics.com
Mon Jun 23 06:31:21 PDT 2008


You must dynamically load the PHPMapscript module in your PHP script,  
with MS4W.  See the example script in /ms4w/Apache/htdocs/quickmap.php

-jeff


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




On 23-Jun-08, at 5:11 AM, Zhao Ying (CDU) wrote:

> Greetings,
>
> I’m trying to test my PHP MapScript environment on MS4W.
> Unfortunately, each time I run the following php file on the apache  
> server within MS4W, a same
> error message is always thrown:
>
> -- Error Message:
> Fatal error: Call to undefined function ms_newMapObj() in C:\ms4w 
> \Apache\htdocs\phpms_hello.php on line 7
>
> -- PHP file:  phpms_hello.php
> This example is from chapter8, book <Apress Beginning MapServer Open  
> Source GIS Development Aug 2005>
> however, according to the author, this example is expected to be run  
> a Linux version mapserver (I guess so),
> so I’m under the assumption that all configuration procedures  
> described in this book before running this example
> won’t work for MS4W.
>
> <?php
>
>   // Create a unique image name every time through
>   $image_name = sprintf("phpms-hello%0.6d",rand(0,999999)).".png";
>
>   // Create a new instance of a map object
>   $map = ms_newMapObj("/ms4w/test2/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="/tmp/<?php echo $image_name; ?>">
>   </form>
> </body>
> </html>
>
>
> Did I miss some configurations for MS4W to work with php or something?
> Thanks!!!
>
> Jeff.
> Chengdu, China
>
>



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20080623/029b59c7/attachment.htm>


More information about the MapServer-users mailing list