Admin Life Errors, Fixes, and Encounters


mod_wsgi apache freebsd python

The version of Apache on older versions of FreeBSD is not compiled with support for multithreading but Python itself is. Normally this would be where Apache 1.3 is being used. The result is that when starting up Apache with mod_wsgi, an error similar to the following can occur:

Syntax error on line 37 of /usr/local/apache2/conf/httpd.conf: \
Cannot load /usr/local/apache2/modules/ into server: \
/usr/local/apache2/modules/ Undefined symbol \

You may also get this Error with apache 1.3

Syntax error on line 244 of /usr/local/etc/apache/httpd.conf:
Cannot load /usr/local/libexec/apache/ into server: \
/usr/local/lib/ Undefined symbol "pthread_attr_destroy"

The solution is to force Apache to preload the reentrant version of the C runtime library which contains the POSIX thread library functions. This can be done by modifying the 'envvars' script, if it exists and is used, contained in the same directory as where the Apache 'httpd' binary is installed, or the Apache startup script, and add the lines:


Step 1.

Set the library to system environment.

# LD_PRELOAD=/usr/lib/
# export LD_PRELOAD

Step 2.

Stop apache then start it up again

[email protected] rc.d # ./apache stop
Stopping apache.
Waiting for PIDS: 35117.

[email protected] rc.d # ./apache start
Starting apache.

[email protected] rc.d #

Comments (0) Trackbacks (0)
  1. Perfect, thanks, a life save. You were the only google search result for an exact string search. Not much others when I modified the search term.

Trackbacks are disabled.