5 | | So, we have two choices: |
6 | | * Recompile suexec to let it pass the TRAC_ENV variable, not advised, so I'll not explain how to do it. |
7 | | * Change our trac.cgi script to set the TRAC_ENV variable by itself, to do this we edit trac.cgi file and add |
| 5 | Setting the TRAC_ENV environment variable as described in TracInstall will not work when using suEXEC feature because the environment variables are filtered and only a limited subset reaches the CGI program. |
| 6 | |
| 7 | There are two obvious workarounds to make things work: |
| 8 | 1. Recompile suexec to let it pass the TRAC_ENV variable; which requires root permissions and is not really advisable anyway. |
| 9 | 2. Change our trac.cgi script to set the TRAC_ENV variable by itself, to do this we edit trac.cgi file and add |
13 | | before the `try:' line. |
| 15 | at the very beginning of the script. |
| 16 | |
| 17 | '''Note: This is a kludge, but works.''' |
| 18 | |
| 19 | ---- |
| 20 | |
| 21 | == Multiple Projects under suEXEC == |
| 22 | When hosting multiple projects under suEXEC, you can either copy the CGI script and change the TRAC_ENV setting for each script, or make a wrapper script around it. |
| 23 | |
| 24 | Here's a contributed script to work around the stripping of environment variables done by suEXEC. |
| 25 | |
| 26 | {{{ |
| 27 | |
| 28 | #!/bin/bash |
| 29 | user="marcenuc" |
| 30 | |
| 31 | prj="${PATH_INFO#/}" |
| 32 | prj="${prj%%/*}" |
| 33 | export TRAC_ENV="/home/${user}/.trac/prj/${prj}" |
| 34 | export SCRIPT_NAME="/~${user}/prj/${prj}" |
| 35 | export PATH_INFO="${PATH_INFO#/${prj}}" |
| 36 | export PYTHONPATH="/home/${user}/sw/lib/python2.3/site-packages" |
| 37 | exec ./trac.cgi |
| 38 | }}} |
| 39 | |
| 40 | ---- |
| 41 | See also: TracInstall, TracMultipleProjects |