[mapserver-users] Re: php mapscript objects in session?

Christopher Condit condit at sdsc.edu
Fri Nov 21 18:24:13 EST 2008


> -----Original Message-----
> From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-
> bounces at lists.osgeo.org] On Behalf Of jim white
> Sent: Friday, November 21, 2008 9:19 AM
> To: mapserver-users at lists.osgeo.org
> Subject: [mapserver-users] Re: php mapscript objects in session?
> 
> 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
> 
> Chris,
> 
> 
> When you attempt to start a session, you need to load the class
> definition first. For example
> 
> <?php
> require('myclass.php');
> session_start();
> ?>
> 
Hi Jim-
Thanks for responding...

Actually, I can store non MapScript objects in the $_SESSION just fine,
but when I attempt to either:
1) add the MapScript object as a private member of my class
2) simply save the MapScript object to the $_SESSION and then reuse, I
get the error.

Have you managed to store MapScript objects in sessions?
-Chris


More information about the mapserver-users mailing list