Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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"

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,

share|improve this question

It is a bad idea to write data to /var/www ; Check whether apparmor for apache is enabled, it may disable writing to that directory (but it is better to use a different one anyway, and chown it 1777).

sudo aa-status

(to check whether apparmor is enabled for apache)

share|improve this answer
Thanks for your response! Yes, apparmor is enabled, and I can't disable it :-(. I changed the log path and now that part is working, but the SLD parameter still fails with a ServiceException: – jorgeas80 Jun 14 '11 at 15:07

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

chmod 777 /var/www/mapserver/log/mylogfile.log
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.