mod_php and mapscript

Ara T Howard ara.t.howard at NOAA.GOV
Fri Jan 19 13:48:21 EST 2007


we're using mod_php with the php mapscript bindings.  initially we had
problems because the binding assume a cgi/transient environment and thought
we'd solved it be relaying the environment.  now, however, i'm experiencing
random crashes of the entire httpd server with maplet that looks like this


   <?php

   #
   # relay environment to emulate normal cgi environment
   #
     reset($_SERVER);
     while (list ($key, $val) = each ($_SERVER)) {
         putenv("$key=$val");
         $_SERVER[$key]=$val;
     };

     dl("php_mapscript.so");
     require('map_equations.php');

     $request = ms_newowsrequestobj();
     $request->loadparams();

     ms_ioinstallstdouttobuffer();

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

     $contenttype = ms_iostripstdoutbuffercontenttype();
     header("Content-Type: $contenttype");

     ms_iogetStdoutBufferBytes();
     ms_ioresethandlers();

   ?>

now, when httpd crashes it crashes big: no error messages or anything and no
response from server whatsoever.  considering mod_php is a persistant
environment i'd assume this is memory corruption/lack of resource cleanup.
are there any obivous things i might try to force clean-up and/or
re-initialize the mapscript library on each request?  any other suggestions?

btw.  running the above cgi via mod_php succeeds only about 70% of the time.
running if from the command-line (forcing weblike environment) works 100% of
the time.  i'm in the process of testing normal cgi mode.

regards.

-a
-- 
we can deny everything, except that we have the possibility of being better.
simply reflect on that.
- the dalai lama



More information about the mapserver-users mailing list