Hello. Does anyone here have experience with Mapserver/php_mapscript? I've just started using them, and I have some problems.

I have a map, which I downloaded from a website and modified slightly to puint the addresses to directories in the server I'm using. The problem is that, although I can display the map, I can't access its layers with php_mapscript. I can remove any of them and the map still displays correctly (minus that layer) Calls to functions getAllLayerNames() and getLayer(0) stop the page from loading, although I can see the value of numlayers and it's 4. Could anyone help me, please?

Here's the map.
--------------------------------------------------------------------------------------------------------------------------------
MAP
NAME "Buenos Aires"
STATUS ON
EXTENT 92000 90500 113500 112000
SIZE 600 600
SHAPEPATH "./demosgis/data"
SYMBOLSET "./demosgis/template/etc/symbols.sym"
FONTSET "./demosgis/template/etc/fonts2.txt"
IMAGECOLOR 255 255 255
IMAGETYPE PNG
UNITS METERS
WEB
MINSCALE 100
MAXSCALE 101500
IMAGEPATH "/var/www/pruebas/mapserver/demosgis/ms_tmp/"
IMAGEURL "demosgis/ms_tmp/"
END
REFERENCE
STATUS ON
IMAGE "./demosgis/data/referencia/keymap.png"
SIZE 80 80
EXTENT 92000 90500 113500 112000
COLOR -1 -1 -1
OUTLINECOLOR 255 0 0
MINBOXSIZE 3
MAXBOXSIZE 0
MARKER 0
MARKERSIZE 0
END
QUERYMAP
STATUS OFF
SIZE -1 -1
COLOR 90 120 255
STYLE HILITE
END
LEGEND
STATUS ON
IMAGECOLOR 255 255 255
POSITION LL
KEYSIZE 20 10
KEYSPACING 5 5
LABEL
TYPE BITMAP
SIZE MEDIUM
POSITION CC
OFFSET 0 15
BUFFER 0
MINDISTANCE -1
MINFEATURESIZE -1
COLOR 0 0 0
SHADOWSIZE 0.5 0.5
BACKGROUNDSHADOWSIZE 1.5 1.5
PARTIALS TRUE
FORCE FALSE
END
END
SCALEBAR
STATUS ON
COLOR 0 0 0
OUTLINECOLOR 0 0 0
IMAGECOLOR 255 255 255
UNITS METERS
INTERVALS 4
SIZE 200 3
STYLE 0
POSITION LL
LABEL
TYPE BITMAP
SIZE MEDIUM
OFFSET 0 0
BUFFER 0
MINDISTANCE -1
MINFEATURESIZE -1
COLOR 0 0 0
SHADOWSIZE 0.5 0.5
BACKGROUNDSHADOWSIZE 1.5 1.5
PARTIALS TRUE
FORCE FALSE
END
END
LAYER
NAME "Silueta"
GROUP "Contorno"
STATUS ON
DATA "./demosgis/data/Silueta/contorno capital"
TYPE POLYGON
UNITS METERS
SIZEUNITS PIXELS

# MapServer necesita que el valor de TEMPLATE sea distinto de vacío pero
# en realidad no chequea que exista el archivo ni nada, ¡es decir que aunque
# no se lo use hay que completarlo igual!
TEMPLATE "silueta.html"

CLASS
STYLE
SYMBOL 0
COLOR 255 255 255
OUTLINECOLOR 0 0 0
END
END
END

LAYER
NAME "Agua"
GROUP "Contorno"
STATUS ON
DATA "./demosgis/data/Silueta/Agua_circ(15)"
TYPE POLYGON
CLASSITEM "NOMBRE"
UNITS METERS
SIZEUNITS PIXELS
LABELITEM "NOMBRE"
LABELMAXSCALE 50000
# MAXSCALE 125000
TOLERANCE 0
TOLERANCEUNITS PIXELS
TEMPLATE "agua_circundante.html"
CLASS
NAME "Agua"
TEXT (RÃ*o de la Plata)
LABEL
TYPE TRUETYPE
FONT "arial_black"
SIZE 14
MINSIZE 14
MAXSIZE 16
POSITION CC
OFFSET 0 15
MINFEATURESIZE -1
COLOR 255 255 255
OUTLINECOLOR 0 0 0
SHADOWCOLOR 0 0 0
SHADOWSIZE 0.5 0.5
BACKGROUNDSHADOWSIZE 1.5 1.5
ANTIALIAS TRUE
FORCE TRUE
END
STYLE
SYMBOL 0
COLOR 51 102 255
SIZE 1
MINSIZE 1
MAXSIZE 100
END
END
END

LAYER
NAME "Barrios"
GROUP "Delimitacion"
STATUS ON
DATA "./demosgis/data/Barrios/barrios(22)"
TYPE POLYGON
CLASSITEM "NOMBRE"
UNITS METERS
SIZEUNITS PIXELS
MINSCALE 20000
LABELITEM "NOMBRE"
LABELMAXSCALE 50000
TOLERANCE 0
TOLERANCEUNITS PIXELS
TEMPLATE "barrios.html"
CLASS
NAME "Barrios"
LABEL
TYPE TRUETYPE
FONT "trebucbd"
SIZE 10
MINSIZE 10
MAXSIZE 14
POSITION CC
OFFSET 0 0
BUFFER 0
MINFEATURESIZE -1
COLOR 0 0 0
SHADOWSIZE 0.5 0.5
BACKGROUNDSHADOWSIZE 1.5 1.5
ANTIALIAS TRUE
FORCE TRUE
END
STYLE
SYMBOL 0
COLOR 255 255 204
OUTLINECOLOR 0 0 0
SIZE 1
MINSIZE 1
MAXSIZE 100
END
END
END

--------------------------------------------------------------------------------------------------------------------------------
Thanks in advance.

Gabi.