Re: [MapServer-users] Docker image for MapServer with PHP-MapScript

2023-10-30 Thread Lime, Steve D (MNIT) via MapServer-users
Map-level metadata lives in the WEB object...

From: MapServer-users  On Behalf Of 
Jan Hartmann via MapServer-users
Sent: Monday, October 30, 2023 12:46 PM
To: Vassilis Chatzigiannakis ; mapserver-users@lists.osgeo.org
Subject: Re: [MapServer-users] Docker image for MapServer with PHP-MapScript

Almost there. There are additional migration examples in: 
https://ms4w.com/trac/wiki/MigrationGuide5.x


I wrote wrapper functions for the old ms_new... functions, and can create that 
way a new mapObj called $oMap.

The "set" function has been  renamed  to "__set" : not 
$oMap->set("maxsize",6020), but: ;$oMap->__set("maxsize",6020);

Layers can be declared as before:  $layer = $oMap->getLayer(1).

Metadata have to be set as follows:

Not: $layer->setMetadata("...","..."); but: $layer->metadata->set("...","...")

However, I cannot set the metadata of the mapObj: 
$oMap->metadata->set("...","...") gives: "Undefined array key "metadata""

Any idea?

On 29/10/2023 07:52, Vassilis Chatzigiannakis wrote:
Yes the documentation is a mess .
I worked with this reference:

https://mapserver.org/mapscript/mapscript-api/index.html

So, you start by
$oMap = new mapObj($mapfile);

Best regards,
Vassilis


From: Jan Hartmann 
Sent: Saturday, October 28, 2023 9:14 PM
To: Vassilis Chatzigiannakis ; 
mapserver-users@lists.osgeo.org
Subject: Re: [MapServer-users] Docker image for MapServer with PHP-MapScript

This seems to work.  And it says so in the migration guide 
(https://mapserver.org/mapscript/php/migration_guide.html):

all of your PHP scripts (that leverage MapServer objects and functions) must 
now always first include the generated mapscript.php file containing MapServer 
constants:

But could it be that only "$m = new mapObj('...');" is accepted, and 
"$m=ms_newMapObj('...');" isn't? The docs still mention the old call 
(https://mapserver.org/mapscript/php/phpmapscript.html
On 28/10/2023 09:11, Vassilis Chatzigiannakis wrote:
Hi,
I did it recently. There should be a mapscript.php file in the same folder as 
the  php_mapscriptng.so extension.
You need to include it in your php script.

Best,
Vassilis


From: MapServer-users 

 On Behalf Of Jan Hartmann via MapServer-users
Sent: Friday, October 27, 2023 9:42 PM
To: mapserver-users@lists.osgeo.org
Subject: Re: [MapServer-users] Docker image for MapServer with PHP-MapScript

I made a docker version of mapserver/php-mapscript myself, based on Ubuntu 
22.04. I installed all required libraries with apt, and compiled mapserver and 
mapscript according to instructions. No problem at all.

At the end I got the following from phpinfo();




mapscript
MapServer Version
MapServer version 8.0.1 PROJ version 9.3 GDAL version 3.4 OUTPUT=PNG 
OUTPUT=JPEG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV 
SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT 
SUPPORTS=WCS_SERVER SUPPORTS=OGCAPI_SERVER SUPPORTS=GEOS INPUT=JPEG 
INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE INPUT=FLATGEOBUF

But no mapscript function or object was regognized in my PHP-scripts:

PHP Fatal error:  Uncaught Error: Class "mapObj" not found in 
/virdir/www_root/test.php:2
Stack trace:
#0 {main}
  thrown in /virdir/www_root/test.php on line 2


I am really desparate. Has anyone ever succeeded to get php_mapscriptng.so to 
work?  Or does anyone know of a working Docker image for MapServer with PHP 
MapScript?

Jan
On 21/10/2023 05:40, Jan Hartmann wrote:
I tried this with serveral versions of PHP and MapServer, but got always the 
same result. Can anyone point me to a Docker image for MapServer + 
PHP-MapScript?

Jan
On 19/10/2023 18:12, Jan Hartmann wrote:
Still not there. Everything has been installed, and phpinfo() gives:
MapServer Version
MapServer version 8.0.1 PROJ version 9.3 GDAL version 3.7 OUTPUT=PNG 
OUTPUT=JPEG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV 
SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT 
SUPPORTS=WCS_SERVER SUPPORTS=OGCAPI_SERVER INPUT=JPEG INPUT=POSTGIS INPUT=OGR 
INPUT=GDAL INPUT=SHAPEFILE INPUT=FLATGEOBUF

But calling "$map = new mapObj('mapfile.map');" gives:

Fatal error: Uncaught Error: Class "mapObj" not found in 
/mnt/virdir/www_root/test/test_mapscript.php:2 Stack trace: #0 {main} thrown in 
/mnt/virdir/www_root/test/test_mapscript.php on line 2

Any idea?

Jan




___
MapServer-users mailing list
MapServer-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [MapServer-users] Docker image for MapServer with PHP-MapScript

2023-10-30 Thread Jan Hartmann via MapServer-users
Almost there. There are additional migration examples in: 
https://ms4w.com/trac/wiki/MigrationGuide5.x



I wrote wrapper functions for the old ms_new... functions, and can 
create that way a new mapObj called $oMap.


The "set" function has been  renamed  to "__set" : not 
$oMap->set("maxsize",6020), but: ;$oMap->__set("maxsize",6020);


Layers can be declared as before:  $layer = $oMap->getLayer(1).

Metadata have to be set as follows:

Not: $layer->setMetadata("...","..."); but: 
$layer->metadata->set("...","...")


However, I cannot set the metadata of the mapObj: 
$oMap->metadata->set("...","...") gives: "Undefined array key "metadata""


Any idea?

On 29/10/2023 07:52, Vassilis Chatzigiannakis wrote:


Yes the documentation is a mess .

I worked with this reference:

https://mapserver.org/mapscript/mapscript-api/index.html

So, you start by

$oMap= newmapObj($mapfile);

Best regards,

Vassilis

*From:* Jan Hartmann 
*Sent:* Saturday, October 28, 2023 9:14 PM
*To:* Vassilis Chatzigiannakis ; 
mapserver-users@lists.osgeo.org
*Subject:* Re: [MapServer-users] Docker image for MapServer with 
PHP-MapScript


This seems to work.  And it says so in the migration guide 
(https://mapserver.org/mapscript/php/migration_guide.html):


all of your PHP scripts (that leverage MapServer objects and 
functions) must now always first include the generated 
mapscript.php file containing MapServer constants:


But could it be that only "$m = new mapObj('...');" is accepted, and 
"$m=ms_newMapObj('...');" isn't? The docs still mention the old call 
(https://mapserver.org/mapscript/php/phpmapscript.html


On 28/10/2023 09:11, Vassilis Chatzigiannakis wrote:

Hi,

I did it recently. There should be a mapscript.php file in the
same folder as the  php_mapscriptng.so extension.

You need to include it in your php script.

Best,

Vassilis

*From:* MapServer-users 
 *On Behalf Of
*Jan Hartmann via MapServer-users
*Sent:* Friday, October 27, 2023 9:42 PM
*To:* mapserver-users@lists.osgeo.org
*Subject:* Re: [MapServer-users] Docker image for MapServer with
PHP-MapScript

I made a docker version of mapserver/php-mapscript myself, based
on Ubuntu 22.04. I installed all required libraries with apt, and
compiled mapserver and mapscript according to instructions. No
problem at all.

At the end I got the following from phpinfo();



mapscript

*MapServer Version*



MapServer version 8.0.1 PROJ version 9.3 GDAL version 3.4
OUTPUT=PNG OUTPUT=JPEG SUPPORTS=PROJ SUPPORTS=AGG
SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=WMS_SERVER
SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT
SUPPORTS=WCS_SERVER SUPPORTS=OGCAPI_SERVER SUPPORTS=GEOS
INPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE
INPUT=FLATGEOBUF


But no mapscript function or object was regognized in my PHP-scripts:

PHP Fatal error:  Uncaught Error: Class "mapObj" not found in
/virdir/www_root/test.php:2
Stack trace:
#0 {main}
  thrown in /virdir/www_root/test.php on line 2


I am really desparate. Has anyone ever succeeded to get
php_mapscriptng.so to work?  Or does anyone know of a working
Docker image for MapServer with PHP MapScript?

Jan

On 21/10/2023 05:40, Jan Hartmann wrote:

I tried this with serveral versions of PHP and MapServer, but
got always the same result. Can anyone point me to a Docker
image for MapServer + PHP-MapScript?

Jan

On 19/10/2023 18:12, Jan Hartmann wrote:

Still not there. Everything has been installed, and
phpinfo() gives:

*MapServer Version*



MapServer version 8.0.1 PROJ version 9.3 GDAL version 3.7
OUTPUT=PNG OUTPUT=JPEG SUPPORTS=PROJ SUPPORTS=AGG
SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=WMS_SERVER
SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER
SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER
SUPPORTS=OGCAPI_SERVER INPUT=JPEG INPUT=POSTGIS INPUT=OGR
INPUT=GDAL INPUT=SHAPEFILE INPUT=FLATGEOBUF


But calling "$map = new mapObj('mapfile.map');" gives:

*Fatal error*: Uncaught Error: Class "mapObj" not found in
/mnt/virdir/www_root/test/test_mapscript.php:2 Stack
trace: #0 {main} thrown in
*/mnt/virdir/www_root/test/test_mapscript.php* on line *2

*Any idea?

Jan

___
MapServer-users mailing list
MapServer-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users