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





_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to