Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#1871 closed defect (worksforme)

2 errors with mapscript using PHP 5.0.4

Reported by: dnadeau@… Owned by: mapserverbugs
Priority: high Milestone:
Component: MapScript-PHP Version: 4.10
Severity: normal Keywords:
Cc:

Description

1-
FILE:
"test_draw_legend_icon.phtml" 80,1      
  $img = $myClass->createLegendIcon($map->keysizex, $map->keysizey);
ERROR:
<P>Draw each icon seperatly.<BR><TABLE BGCOLOR=WHITE><br />
<b>Fatal error</b>:  [MapServer Error]: msCreateLegendIcon(): Unable to
initialize image.
 in
<b>/usr/local/mapserver/mapscript/php3/examples/test_draw_legend_icon.phtml</b>
on line <b>70</b><br />

2-
FILE:
test_layer_mask.phtml" 45    

$map->SelectOutputFormat("PNG");

ERROR:
<b>Fatal error</b>:  Object expected as argument. in
<b>/usr/local/mapserver/mapscript/php3/examples/test_layer_mask.phtml</b> on
line <b>45</b><br />

Denis

Change History (8)

comment:1 by dnadeau@…, 18 years ago

Version: unspecified4.10

comment:2 by dmorissette, 18 years ago

Resolution: worksforme
Status: newclosed
Denis, both examples work for me with the latest php_mapscript.

Are you using the Gmap mapfile to run them (and edit the scripts to point to
it)? It is possible that they contain some assumptions that make them work only
with that mapfile.

I'll close as WORKSFORME. Please reopen with more details about your config if
you were using the Gmap mapfile when you got those errors.

comment:3 by dnadeau@…, 18 years ago

Daniel,

I am useing gmap mapfile to test php.

Denis

...
$map = ms_newMapObj("/usr/local/mapserver/mapscript/php3/gmap/htdocs/gmap75.map");
...

gmap75.map
#
# Start of GMAP map file
#
#
NAME GMAP_DEMO
STATUS ON
SIZE 400 300
SYMBOLSET ../etc/symbols.sym
EXTENT -2200000 -712631 3072800 3840000
UNITS METERS
SHAPEPATH "../data"
IMAGECOLOR 255 255 255
FONTSET ../etc/fonts.txt


#
# Start of web interface definition
#
WEB
  MINSCALE 2000000
  MAXSCALE 50000000
#
# On Windows systems, /tmp and /tmp/ms_tmp/ should be created at the root
# of the drive where the .MAP file resides.
#
  IMAGEPATH "/tmp/ms_tmp/"
  IMAGEURL "/ms_tmp/"
END

#
# Start of reference map
#
REFERENCE
   IMAGE images/keymap.png
   EXTENT -2200000 -712631 3072800 3840000
   STATUS ON
  COLOR -1 -1 -1
  OUTLINECOLOR 255 0 0
  SIZE 120 90
END

#
# Start of legend
#
LEGEND
  KEYSIZE 18 12
  LABEL
    TYPE BITMAP
    SIZE MEDIUM
    COLOR 0 0 89
  END
  STATUS ON
END

#
# Start of scalebar
#
SCALEBAR
  IMAGECOLOR 255 255 255
  LABEL
    COLOR 0 0 0
    SIZE SMALL
  END
  SIZE 150 5
  COLOR 255 255 255
  BACKGROUNDCOLOR 0 0 0
  OUTLINECOLOR 0 0 0
  UNITS kilometers
  INTERVALS 5
  STATUS ON
END


QUERYMAP
  STYLE HILITE
  COLOR 255 0 0
END


#
# Start of layer definitions
#


LAYER
  NAME bathymetry
  METADATA
    "DESCRIPTION" "Elevation/Bathymetry"
  END
  TYPE RASTER
  STATUS ON
  DATA bath_mapserver.tif
END

LAYER
  NAME land_fn
  METADATA
    "DESCRIPTION" "Foreign Lands"
  END
  TYPE POLYGON
  STATUS ON
  DATA land_fn
  CLASS
    NAME "Foreign Lands"
    STYLE
      COLOR 240 240 240
      OUTLINECOLOR 199 199 199
    END
  END
END # layer

LAYER
  NAME park
  METADATA
    "DESCRIPTION"   "Parks"
    "RESULT_FIELDS" "NAME_E YEAR_EST AREA_KMSQ"
  END
  TYPE POLYGON
  STATUS OFF
  DATA park
  CLASS
    NAME "Parks"
    STYLE
      COLOR 200 255 0
      OUTLINECOLOR 120 120 120
    END
    TEMPLATE "ttt_query.html"
  END
  TOLERANCE 5
END # Layer

LAYER
  NAME drain_fn
  METADATA
    "DESCRIPTION" "Water"
  END
  TYPE POLYGON
  STATUS ON
  DATA drain_fn
  CLASSITEM "Poly_featu"
  CLASS
    EXPRESSION /16|21/
    NAME "Water"
    STYLE
      COLOR 225 249 255
      OUTLINECOLOR 186 234 245
    END
  END
END # layer

LAYER
  NAME drainage
  METADATA
    "DESCRIPTION" "Drainage"
  END
  TYPE POLYGON
  STATUS ON
  DATA drainage
  CLASSITEM "Poly_featu"
  CLASS
    EXPRESSION "0"
    NAME "Water"
    STYLE
      COLOR 225 249 255
      OUTLINECOLOR 186 234 245
    END
  END
END # layer

LAYER
  NAME prov_bound
  METADATA
    "DESCRIPTION" "Province"
  END
  TYPE LINE
  STATUS ON
  DATA province
  CLASS
    NAME "Province"
    STYLE
      COLOR 120 120 120
    END
  END
END # layer

LAYER
  NAME fedlimit
  METADATA
    "DESCRIPTION" "Federal Limit"
  END
  TYPE LINE
  STATUS ON
  DATA fedlimit
  CLASS
    NAME "Federal Limit"
    STYLE
      SYMBOL 3
      COLOR 0 119 255
    END
  END

END # Layer

LAYER
  NAME rail
  METADATA
    "DESCRIPTION" "Railroads"
  END
  TYPE LINE
  STATUS OFF
  DATA rail
  CLASS
    NAME "Railroads"
    STYLE
      SYMBOL 0
      COLOR 168 0 184
    END
  END
END # Layer

LAYER
  NAME road
  METADATA
    "DESCRIPTION" "Roads"
  END
  TYPE LINE
  STATUS OFF
  DATA road
  CLASS
    NAME "Roads"
    STYLE
      SYMBOL 0
      COLOR 220 0 0
    END
  END
END # Layer

LAYER
  NAME popplace
  METADATA
    "DESCRIPTION"   "Cities"
    "RESULT_FIELDS" "NAME"
  END
  TYPE POINT
  STATUS ON
  DATA popplace
  LabelItem "Name"
  CLASSITEM "Capital"
  CLASS
    EXPRESSION "1"
    TEMPLATE "ttt_query.html"
    NAME "Cities"
    LABEL
      COLOR  255 0 0
      FONT sans-italic
      TYPE truetype
      SIZE 8
      POSITION AUTO
      PARTIALS FALSE
      OUTLINECOLOR 255 255 255
    END
    STYLE
      SYMBOL 2
      SIZE 8
      COLOR 0 0 0
    END
  END
  CLASS
    EXPRESSION /2|3/
    TEMPLATE "ttt_query.html"
    NAME "Cities"
    LABEL
     COLOR  0 0 0
     FONT sans
     TYPE truetype
     SIZE 8
     POSITION AUTO
     PARTIALS FALSE
     OUTLINECOLOR 255 255 255
    END
    STYLE
      SYMBOL 7
      SIZE 6
      COLOR 0 0 0
    END
  END
  TOLERANCE 5
END # Layer

LAYER
  NAME "grid"
  METADATA
    "DESCRIPTION" "Grid"
  END
  TYPE LINE
  STATUS OFF
  DATA "grid"
  CLASS
    NAME "Graticule"
    STYLE
      COLOR 0 0 0
    END
  END
END # Layer


END # Map File

comment:4 by dnadeau@…, 18 years ago

What PHP version are you using?  I have tried with PHP 4 and I got no errors but
warnings about MS_PNG not being defined?

comment:5 by dmorissette, 18 years ago

The MS_PNG notices were caused by stray args that should not have been there.
The saveWebImage() method doesn't take any arguments any more since the
outputFormat stuff was added (in 4.0 I think). I have fixed that in
test_draw_legend_icon.phtml in CVS, but I don't think that could have been
related to your problem. 

comment:6 by dmorissette, 18 years ago

I have tested this with both php 4.3.6 and 5.1.5 and get the same results.

comment:7 by dnadeau@…, 18 years ago

I had php 4 mixed up with php 5 on my machine and I needed to clean up.  This is
probably why it did not compiled correctly.  

comment:8 by dmorissette, 18 years ago

The problem was cliflicting GD versions between mapserver/php_mapscript and the
PHP bundled GD. Bug 1879 has been created to try to prevent that situation in
the future.
Note: See TracTickets for help on using tickets.