I'm making a portable installation of Apache to run Bugzilla. This installation has a portable version of Perl and it's the one I want mod_cgi to use. However, mod_cgi doesn't have any way to configure the intended binary (or binaries per file type), so it depends on the shebang to know what to execute.
My problem is this: Bugzilla's perl files have a shebang that points to #!/usr/bin/perl -T
and since I'm on Windows (unfortunately nothing can be done about this) and I want to use the particular Perl distribution intended for the server, I need to modify the shebangs.
I know I can just run a perl script beforehand and just replace all the shebangs with ones pointing to the proper binary, but I would prefer a solution that is more robust. I thought of filters and mod_lua, but Apache and its modules seem to have no hooks or directives that allow processing files before they're sent to the cgi process. They can only process requests sent by a client or the final output before it's sent back to the client.
Is there any way to process a file, using Apache or a module, before it is sent to the cgi process?
Is there a way to make the cgi process think that my intended perl is in fact in /usr/bin/perl
?