[mapserver-users] php mapscript objects in session?

Umberto Nicoletti umberto.nicoletti at gmail.com
Fri Nov 21 08:08:10 EST 2008


On Fri, Nov 21, 2008 at 11:55 AM, Pietro Giannini <pgiannini at bytewise.it> wrote:
> Ciao Umberto,
>
> excuse me, but your statement has put me in a state of anxiety :)
>
> Currently I'm involved in an ASP.NET C# mapscript developement, and I use
> extensively the method of saving mapscript object in session.
> Naturally I tested the envirenmnet with a certain number of concurrent
> users, and I don't get any strange issue, like accessing to an object of
> another session.

so, do you share objects (like a mapobj) between sessions (ie:
different requests use the same mapObj instance to perform map
drawing) without locking at application (c# in your case) level?
If the answer is yes you've just been lucky so far as this approach
will surely lead to errors.

>
> Why do you say this is NOT recommended?
>

I'm sorry, I can't provide technical arguments right now, but in my
experience (+3years with Java mapscript) this solution proved to be
the most stable.
YMMV.

Ciao,
Umberto

> ciao .......................pg
>
> --
> Pietro Giannini
> Bytewise srl - Area GIS
> 41°50'38.58"N 12°29'13.39"E
>
>
> On Ven, Novembre 21, 2008 10:20, Umberto Nicoletti wrote:
>> And even if it was possible it is NOT recommended to reuse mapscript
>> objects across requests, see my previous post on the "Mapserver Thread
>> Safety" thread earlier this week.
>>
>> Umberto
>>
>> On Fri, Nov 21, 2008 at 10:13 AM, Pietro Giannini <pgiannini at bytewise.it>
>> wrote:
>>> according to my little knowledge, php cannot store an instance of an
>>> object in a session, only primitives variables like strings, integers,
>>> floats and arrays (asp.net instead can).
>>>
>>> for your app you must save the context (mapfile path, the extent, the
>>> layers status etc.), and re-instance the map object at each postback.
>>>
>>> hth
>>>
>>> ........................pg
>>>
>>>
>>>
>>> --
>>> Pietro Giannini
>>> Bytewise srl - Area GIS
>>> 41°50'38.58"N 12°29'13.39"E
>>>
>>>
>>>
>>> On Ven, Novembre 21, 2008 00:33, Christopher Condit wrote:
>>>> Hi-
>>>> I'm using ms4w 2.2.7 and I've run into a problem. Ideally I'd like to
>>>> create the MapScript map object and store it in the session:
>>>>
>>>> $_SESSION['map'] = ms_newMapObj($getMapPath);
>>>>
>>>> This works fine for the that page, for the first call, but when I
>>>> attempt to reference it later I get a PHP error:
>>>> Fatal error: Object has an invalid _handle_ property
>>>>
>>>> Am I missing something here?
>>>>
>>>> Thanks,
>>>> -Chris
>>>>
>>>> _______________________________________________
>>>> mapserver-users mailing list
>>>> mapserver-users at lists.osgeo.org
>>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>>>
>>>
>>> _______________________________________________
>>> mapserver-users mailing list
>>> mapserver-users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>>
>>
>
>
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>


More information about the mapserver-users mailing list