# Mapserver mapfile with multiple layers that pull from postgis only gives broken image

I'm trying to use this mapfile that I made:

MAP
IMAGETYPE PNG
EXTENT -90.000124 41.000032 -88.000044 42.000035
SIZE 1600 800
IMAGECOLOR 255 0 1

OUTPUTFORMAT
NAME png
DRIVER AGG/PNG
MIMETYPE "image/png"
IMAGEMODE RGBA
EXTENSION "png"
FORMATOPTION "GAMMA=0.75"
TRANSPARENT ON
END

LAYER
NAME poly
STATUS OFF
TYPE POLYGON
CONNECTIONTYPE POSTGIS
DATA "the_geom from g41088"
OPACITY 50
CLASS
NAME g41088P
STYLE
COLOR 200 200 200
OUTLINECOLOR 0 0 0
END
END
END

#LAYER
#  NAME line
#  STATUS OFF
#  TYPE LINE
#  CONNECTIONTYPE POSTGIS
#  CONNECTION "host=127.0.0.1 dbname=matt user=postgres password=postgres"
#  DATA "the_geom from g41088"
#   CLASS
#     NAME g41088L
#       STYLE
#         COLOR 0 0 0
#       END
#   END
#END
END


But it only works when I have the second layer commented out. I can't figure out for the life of me what's wrong with it. I'm trying to do the same thing that this tutorial is doing, but with PostGis support.

your

NAME line


is probably causing the error, as "line" is a reserved mapfile keyword. Try with

NAME "line"


As a rule of thumb, you should always quote strings in a mapfile, even though the parser does allow strings that are not a reserved keyword to be left unquoted.

Perhaps you need to define the projection there or in the WEB section. Also it could be related to the mapserver executable, probably it's not located in the cgi-bin directory, so this isn't accessible in your HTML code. Try these links, especially the getCapabilities to see what error messages you get: