PHP in native mode...

Sean Gillies sgillies at FRII.COM
Wed Aug 25 10:59:25 EDT 2004


On Aug 23, 2004, at 5:05 PM, Stephen Malenshek wrote:

> I am in the process of setting up mapserver and I HAVE to have it run
> in a non-cgi mode because of the other sites that are being hosted on
> this box, and I have major concerns regarding running php in cgi mode.
> With that in mind, I have the following questions..
>
> 1) What is the status of the code changes?
> 2) How do you force the configure script to ignore the warning messages
> and continue in non-cgi mode?
> 3) Is anyone presently running the software in non-cgi mode?  I have
> read all the documents talking about the sporadic problems with this,
> but I am curious as to what "worst case" is...
>
> Thanks for your time.
>
> Stephen
>
>

Stephen, I am not a PHP user but maybe I can help you out with #3.

I'm using mapscript with mod_python, this is analogous to native PHP,
yes?
Each site visitor has a separate Apache thread and each server thread
contains a Python sub-interpreter that shares a namespace with other
threads.  This allows global objects for your web application.
Mod_python
and mapscript is working very well for me, but I am being *extremely*
careful.

There are at least two issues of thread safety.  The first is core
MapServer code.  We're using an unsafe lexer.  Mapfile parsing is
protected.  A performance bottleneck, but safe.  However, there are
no fine-grained locks around expression parsing code and this means
that dynamically changing class expressions and layer filters may not
be thread safe.  I *am* successfully making changes to a layer filter,
but your mileage may vary.

The second is supporting libraries.  Almost all of us, I'd bet, use
GDAL and/or OGR.  At MUM2, Frank Warmerdam stated that these are not
thread safe.  GDAL raster access is protected, but I have not seen
any locks used in mapogr.c which leads me to believe that OGR vector
access is not thread safe.  Please correct me if I am wrong ... Frank?

I am using *only* local shapefiles, PostGIS, and WMS rasters in my
mod_python application.  I do not share a mapObj among threads, and
I use a very recent version of GD.  GD 2.0.16 fixed a rare race
condition in truetype font cache access.  There may be PHP mapscript
issues of which I am unaware, but I think that careful use of
PHP mapscript in native should be possible.

Hopefully, the PHP mapscript developers will weigh in eventually if
we keep the thread alive :)

cheers,
Sean

--
Sean Gillies
sgillies at frii dot com
http://users.frii.com/sgillies



More information about the mapserver-users mailing list