Legend:

Trac supports [http://www.modpython.org/ mod_python], which speeds up Trac's response times considerably, especially compared to [TracCgi CGI], and permits use of many Apache features not possible with [wiki:TracStandalone tracd]/mod_proxy.

5

5

6

These instructions are for Apache 2; if you are still using Apache 1.3, you may have some luck with [wiki:TracModPython2.7 TracModPython2.7].

''Note: The exact path to the module depends on how the HTTPD installation is laid out.''

14

15

You can test your mod_python installation by adding the following to your httpd.conf. You should remove this when you are done testing for security reasons.

16

{{{

16

On Debian using apt-get

17

{{{

18

apt-get install libapache2-mod-python libapache2-mod-python-doc

19

}}}

20

(Still on Debian) after you have installed mod_python, you must enable the modules in apache2 (equivalent of the above Load Module directive):

21

{{{

22

a2enmod mod_python

23

}}}

24

On Fedora use, using yum:

25

{{{

26

yum install mod_python

27

}}}

28

You can test your mod_python installation by adding the following to your httpd.conf. You should remove this when you are done testing for security reasons. Note: mod_python.testhandler is only available in mod_python 3.2+.

The option '''`TracUriRoot`''' may or may not be necessary in your setup. Try your configuration with out it, and if the URLs produced by Trac look wrong or if Trac does not seem to recognize the URLs correctly, add the '''`TracUriRoot`''' option. You will notice that the `Location` and '''`TracUriRoot`''' have the same path.

50

The option '''`TracUriRoot`''' may or may not be necessary in your setup. Try your configuration without it; if the URLs produced by Trac look wrong, if Trac does not seem to recognize URLs correctly, or you get an odd "No handler matched request to..." error, add the '''`TracUriRoot`''' option. You will notice that the `Location` and '''`TracUriRoot`''' have the same path.

Note 1: This is the case where the LDAP search will get around the multiple OUs, conecting to Global Catalog Server portion of AD (Notice the port is 3268, not the normal LDAP 389). The GCS is basically a "flattened" tree which allows searching for a user without knowing to which OU they belong.

Note: !DocumentRoot should not point to your Trac project env. As Asmodai wrote on #trac: "suppose there's a webserer bug that allows disclosure of !DocumentRoot they could then leech the entire Trac environment".

226

117

227

== Troubleshooting ==

118

228

119

229

In general, if you get server error pages, you can either check the Apache error log, or enable the `PythonDebug` option:

Pay attention to the version of the installed mod_python and sqlite packages. Ports have both the new and old ones, but earlier versions of pysqlite and mod_python won't integrate as the former requires threaded support in python, and the latter requires a threadless install.

163

287

288

If you compiled and installed apache2, apache wouldn´t support threads (cause it doesn´t work very well on FreeBSD). You could force thread support when running ./configure for apache, using --enable-threads, but this isn´t recommendable.

289

The best option [[http://modpython.org/pipermail/mod_python/2006-September/021983.html seems to be]] adding to /usr/local/apache2/bin/ennvars the line

If this is not the case, it's possible that you're using Subversion libraries that are binary incompatible with the apache ones (an incompatibility of the `apr` libraries is usually the cause). In that case, you also won't be able to use the svn modules for Apache (`mod_dav_svn`).

300

301

You also need a recent version of `mod_python` in order to avoid a runtime error ({{{argument number 2: a 'apr_pool_t *' is expected}}}) due to the default usage of multiple sub-interpreters. 3.2.8 ''should'' work, though it's probably better to use the workaround described in #3371, in order to force the use of the main interpreter:

302

{{{

303

PythonInterpreter main_interpreter

304

}}}

305

This is anyway the recommended workaround for other well-known issues seen when using the Python bindings for Subversion within mod_python (#2611, #3455). See in particular Graham Dumpleton's comment in [comment:ticket:3455:9 #3455] explaining the issue.

306

307

=== Page layout issues ===

308

309

If the formatting of the Trac pages look weird chances are that the style sheets governing the page layout are not handled properly by the web server. Try adding the following lines to your apache configuration:

310

{{{

311

#!xml

312

Alias /myproject/css "/usr/share/trac/htdocs/css"

313

<Location /myproject/css>

314

SetHandler None

315

</Location>

316

}}}

317

318

Note: For the above configuration to have any effect it must be put after the configuration of your project root location, i.e. {{{<Location /myproject />}}}.

319

320

=== HTTPS issues ===

321

322

If you want to run Trac fully under https you might find that it tries to redirect to plain http. In this case just add the following line to your apache configuration:

323

{{{

324

#!xml

325

<VirtualHost * >

326

DocumentRoot /var/www/myproject

327

ServerName trac.mycompany.com

328

SetEnv HTTPS 1

329

....

330

</VirtualHost>

331

}}}

332

333

=== Fedora 7 Issues ===

334

Make sure you install the 'python-sqlite2' package as it seems to be required for TracModPython but not for tracd

335

336

337

=== Segmentation fault with php5-mhash or other php5 modules ===

338

You may encounter segfaults (reported on debian etch) if php5-mhash module is installed. Try to remove it to see if this solves the problem. See debian bug report [[http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=411487]]

339

340

Some people also have troubles when using php5 compiled with its own 3rd party libraries instead of system libraries. Check here [[http://www.djangoproject.com/documentation/modpython/#if-you-get-a-segmentation-fault]]