I try to setup Trac on a shared server with shell access, SW is Trac 1.0.1, Python 2.6.6, Apache 2.2.15 with mod_fcgid and mod_suexec.

I've set it up following the instructions from the wiki of my hoster, https://uberspace.de/dokuwiki/cool:trac . The only difference is that my TRAC_ENV directory lives in a subdirectory, not directly in my home (i.e. ~/path/to/trac, not ~/trac). (And I renamed trac.fcgi to foo-trac.fcgi in the DocRoot, as follows. But I also tried with renaming back to trac.fcgi.)

As written there, I've copied trac.fcgi (and also tried with trac.cgi) from TRAC_ENV/deploy/cgi-bin/ to $DocRoot/foo/foo-trac.fcgi and added

Options +ExecCGI
AddHandler fcgid-script .fcgi   # also tried "AddHandler cgi-script .cgi"
RewriteEngine On
RewriteBase /foo
RewriteRule ^$ foo-trac.fcgi  [L]   # also tried foo-trac.cgi
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) foo-trac.fcgi/$1  [QSA,L]  # also tried foo-trac.cgi

to $DocRoot/foo/.htaccess.

TRAC_ENV is correctly set in foo-trac.f?cgi (with absolute path starting from /),

But for now, I only get "500 Internal Server Error", and in my error_log I get

(104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
Premature end of script headers: foo-trac.fcgi

(with fcgi), respectively

suexec failure: could not open log file
fopen: Permission denied
Premature end of script headers: foo-trac.cgi

(with cgi).

All the .f?cgi files, their directories, the .egg_cache directory (I have mkdir'ed it, hasn't existed and wasn't made by trac (or python) itself) and also the log directories are mode 0755. Log files are 0644 (I've touch'ed them in a try).

(Well, Apache log dir and files are owned by (and group is also) root. But of course I don't try to write any logs by myself there, and TRAC_ENV/log/ and ~/log/ are mine, and I also tried to set mode 777 (dir) respectively 666 (trac.log) - doesn't help, so I reversed that modes again to 755/644.)

I have also already tried/checked the hints from http://encodable.com/internal_server_error/ and /suexec_problems/ there, but nothing works or helps.

Any hints where to search for the problem (seems it's suexec, but maybe it is the rewrite rules; but/and), how to discover it? Or maybe anyone directly has a solution? :)



  • uuhm... how could I mark this question as "solved"? :) – panne Jul 26 '13 at 19:19

Well, I've got the answer.

And I have to apologize: it's been one of the hints at http://encodable.com/internal_server_error/ , even though - and I have been naive enough to believe, the line endings must have been correct (Unix style, NOT Windows like CR/LF endings), because I'm working only with Linux.

And I didn't thought I would have got broken files from the trac poject... But that's the case, thanks to support of my hoster uberspace.de, whom had find it. :)

So, a simple dos2unix trag.fcgi solved the problem - but in the whole TRAC_ENV directory and the libraries (in my case in ~/lib/python2.6/) are lots of CRLF ending files, so I recommend something like

for file in $( find $TRAC_ENV $LIB_DIR -type f | xargs file | grep -i text | grep CRLF | cut -d\: -f1 ); 
   dos2unix $file

and you should be happy again! ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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