[GIS] Mapserver can’t write in /var/www/mapserver/log/

mapserversld

I'm executing Mapserver 5.6.4 under Apache2 in a Ubuntu 10.04 machine.
I'm having problems writing log file. In the mapfile, I have:

CONFIG  "MS_ERRORFILE" "/var/www/mapserver/log/mylogfile.log"
DEBUG   5

Any request I make gets the same answer

msSetErrorFile(): General error message. Failed to open MS_ERRORFILE
/var/www/mapserver/log/mylogfile.log

If I change the path to /tmp/mylogfile.log it works, but then I have a
similar problem with SLD:

msHTTPExecuteRequests(): HTTP request error. HTTP: request failed with
curl error code 7 (Failed connect to mymachine:80; Operation now in
progress) for http://mymachine/sld/polygon_simplepolygon.sld
msSLDApplySLDURL: WMS server error. Could not open SLD
http://mymachine/sld/polygon_simplepolygon.sld and save it in
temporary file /var/www/mapfiles/4df0f886_22dd_0.sld.xml. Please make
sure that the sld url is valid and that imagepath and imageurl are set
properly in the map file

IMAGEPATH and IMAGEURL are properly set in Mapfile (a writable
directory and a correct url). The log directory belongs to www-data,
and the SLD directory too, and www-data has write permission in both directories. I made a test executing, with the www-data user, a python script that creates a file in those directories and it works.

Why mapserv process can't do it? Even when I change the permissions of log directory or SLD directory to 777, mapserv can't write on them, but it can it /tmp. Why?

Many thanks in advance, and best regards,

Best Answer

Just change the permission (777 is sufficient) to your logfile. In your case:

chmod 777 /var/www/mapserver/log/mylogfile.log