Skip to content

Apache2::SSI module tries to set document_root after threads have been started in multithreaded Apache2. Cannot use SSI.pm in threaded Apache2.

Trying to use Apache2::SSI module with Apache2 and mod_perl 2 that has been compiled with threads enabled. However, on any request that hooks into the SSI module (e.g. via PerlOutputFilterHandler -or- PerlResponseHandler) the core apache code returns a 500 error. The following error message is recorded in the apache error logs:

[Tue Jan 09 15:55:58.569837 2024] [perl:error] [pid 1263438:tid 140657668642368] [client xxx.xxx.xxx.xx:57475] Can't run 'setting $r->document_root' in the threaded environment after server startup at /usr/local/lib/perl5/site_perl/5.38.0/Apache2/SSI/URI.pm line 354.\n

[Tue Jan 09 15:55:58.569868 2024] [core:debug] [pid 1263438:tid 140657668642368] core.c(4998): (500)Unknown error 500: [client xxx.xxx.xxx.xx:57475] AH00133: default_handler: ap_pass_brigade returned 500

The pertinent lines from httpd.conf are:

LoadModule perl_module modules/mod_perl.so
PerlModule Apache2::SSI PerlOptions +GlobalRequest -SetupEnv
DocumentRoot "/example/htdocs"

<Directory "/example/htdocs">
   ### Options for Apache2::SSI
   SetHandler modperl
   PerlOutputFilterHandler Apache2::SSI
   AcceptPathInfo On
   ...
</Directory>

<Files *.html>
   SetHandler modperl
   PerlOutputFilterHandler Apache2::SSI
</Files>
Edited by William Barto