Christopher Condit wrote:
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:mapserver-users-
[EMAIL PROTECTED] On Behalf Of jim white
Sent: Friday, November 21, 2008 9:19 AM
To: [email protected]
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


Chris,

No I haven't saved a Mapscript object. Perhaps this is more a response to another post that said you could only access session variables, and not classes, from another page. However, you might try replacing

require('myclass.php');

with
if(!extension_loaded('MapScript')){
        dl("php_mapscript.so");
}

There must be a way to persist a mapscript object, but I don't know enough of 
OO design to tell you the answer.

Jim




--
James (Jim) B. White
tel: (919)-380-9615
homepage: http://jimserver.net/
_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to