It took me a couple of days to get back to this. I looked at it fpor a 
while today. I'm completely baffled.

In the end I went with a *very* stripped down setup that doesn't even have 
trac in it, and I still get errors, so I *guess* it's an apache config 

What I have in httpd.conf is :

WSGIScriptAlias /apacheTest /usr/local/apacheTest/wsgiTest.wsgi
<Directory /usr/local/apacheTest>
 Order allow,deny
 Allow from all
 Require all granted

And in wsgiTest.wsgi :


import os
import subprocess

def application(environ, start_response):
   start_response('200 OK',[('Content-type','text/html')])


   for key in os.environ.keys():
      envStr = envStr + '<B>' + key + '</b> is set to <B>' + 
os.environ[key] + '</b><br>\n'

   statusStr="File operation <B>OK</b>"
      file=open('/usr/local/apacheTest/testTimes.dat', 'a')
      statusStr="File operation <B>FAILED</b>"

   return ['<html><body>In WSGI test script with env :<br>' + envStr + 
          '<br><br>/bin/pwd returned : ' + pwd + 
          '<br>/bin/whoami returned : ' + whoami +
          '<br><br>' + statusStr + '<br><br>' + 
          date + '</body></html>']

And the result is that is shows this :

Or, to cut-and-paste that web page into this reply, it shows that the wsgi 
script is being run by user apache with a minimal path and environment, and 
that the attempt to write to a file in the apacheTest/ directory (which is 
owned by apache - I made sure of that!) fails. So that web page looks like 
this :

In WSGI test script with env :
*LANG* is set to *C*
*PATH* is set to */usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin*
*NOTIFY_SOCKET* is set to */run/systemd/notify*

/bin/pwd returned : / 
/bin/whoami returned : apache 

File operation *FAILED*

Tue Feb 13 12:46:55 MST 2018 

The thing is, I can "su -m apache" and then cd into that directory and run 
a python script that is essentially a copy of the wsgiTest.wsgi (but run as 
main rather than as a function) and it all just works. I don't see anything 
in the apache error logs, either.

I know everyone said to run tracd under strace, and really, THANK YOU for 
that suggestion, but I wanted to try this first. It seems like it's 
something in the Apache setup? Or the configuration of mod_wsgi? And I 
can't see what, although I'm not very familiar with either of those things.

Any thoughts/suggestions appreciated!

On Friday, February 9, 2018 at 1:01:23 PM UTC-7, Niles Oien wrote:
> Hi all,
> I have a puzzling error.
> I am running on CentOS Linux release 7.4.1708. I installed 
> trac-1.0.13-1.el7.noarch through yum. I'm trying to get an initial trac 
> setup going. In my httpd.conf I have :
> WSGIScriptAlias /trac /var/www/trac/trac.wsgi
> <Directory /var/www/trac>
>     WSGIApplicationGroup %{GLOBAL}
>     # For Apache 2.2
>     # <IfModule !mod_authz_core.c>
>     #    Order deny,allow
>     #    Allow from all
>     # </IfModule>
>     # For Apache 2.4
>     <IfModule mod_authz_core.c>
>         Require all granted
>     </IfModule>
> </Directory>
> I did an initenv and deploy with trac-admin.
> If I pull up the trac web page, it comes up in a browser, but I get this 
> message :
> Error with navigation contributor "BrowserModule"
> Can't synchronize with repository "(default)" (The user <tt>apache</tt> 
> requires read _and_ write permissions to the database file 
> /var/www/trac/db/trac.db and the directory it is located in.). Look in the 
> Trac log for more information.
> The user apache requires read _and_ write permissions to the database 
> file /var/www/trac/db/trac.db and the directory it is located in.
> And if I turn logging on so I can look at the log, I get this in the 
> browser :
> TracError: IOError: [Errno 13] Permission denied: 
> u'/var/www/trac/log/trac.log'
> So, basically, both errors would sem to be traceable to nothing under 
> /var/www/trac/ being 'apache' read-writeable.
> But I've done this :
> chown -R apache:apache /var/www/trac
> I can su -m apache and create and delete files under /var/www/trac as 
> apache. I can run sqlite3 like so : sqlite3 db/trac.db --- and then I can 
> do updates on tables in the database, and reverse them. I've tried this 
> simple WSGI script to test the apache/mod_wsgi/python setup :
> def application(environ, start_response):
>         start_response('200 OK',[('Content-type','text/html')])
>         return ['<html><body>Hello World!</body></html>']
> And it seems to work (I get "Hello world" in the browser).
> I don't see anything in the apache error logs, and nothing unremarkable in 
> the access logs. The apache setup is utterly vanilla, nothing at all non 
> standard, it certainly seems to be running as user apache.
> Please help, it's quite baffling - all the error messages I'm getting 
> suggest that it's a permissions issue for user apache under /var/www/trac/ 
> and I am absolutely not seeing that.
> Thanks,
> Niles Oien National SOlar Observatory Boulder CO

You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
To post to this group, send email to
Visit this group at
For more options, visit

Reply via email to