Public bug reported:

I've installed Ampache from the Ubuntu Maverick repository (version
3.5.4-7ubuntu1). It has a problem, though. When I visit my "ampache" web
site, hosted in Apache 2.2 (also from the repository), each page is
plastered with messages like:

    Unable to write to log (/var/log/ampache/ampache.20110219.log)
Please check your log_path variable in ampache.cfg.php

This problem occurs only once I enabled logging through ampache.cfg.php:
    debug="true";
    log_path="/var/log/ampache";
It also only happens after the system has been sitting for a day (so that the 
daily catalog update job gets run). Even then it's not for certain. The update 
job has to run first that day; if the web site gets hit first, then all is fine.

My web site is not public, but you can see identical behaviour on this
site, which I found through Google (nothing to do with me):

http://spacemachines.net/ampache/localplay.php?action=show_playlist

** Warning ** you're likely violating someone's intellectual property
rights if you actually try to play a song from this site.

The underlying problem is that the log file is created each day by
user/group root/root, but Apache of course runs as user/group www-data
/www-data. My guess as to why this happens is because ampache is set up
with a cron job as well, and it's creating the log file first (as it is
a php script that pulls in the same Ampache configuration script). Here
are some directory lists to show the log file situation:

drwxrwxr-x 3 www-data www-data 12288 2011-02-20 12:45 /var/log/ampache
-rw-r--r-- 1 root root   6537 2011-02-15 22:06 
/var/log/ampache/ampache.20110215.log
-rw-r--r-- 1 root root 582053 2011-02-15 22:06 
/var/log/ampache/ampache-catalog.20110215.log

A possible solution is to replace the command at the end of 
/etc/cron.daily/ampache with this command. This should work for both Apache and 
lighttpd web servers, but will fail if the log directory is moved from its 
default:
    logowner=$(ls -dl /var/log/ampache | sed 's/^d......... [0-9]\+ \([^ ]\+\) 
.*/\1/')
    sudo -u ${logowner} php /usr/share/ampache/www/bin/catalog_update.inc -a -c

** Affects: ampache (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/722274

Title:
  When logging is enabled, web pages display "Unable to write to log"

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to