Solution to execute CGI scripts

365 views Asked by At

I have some CGI scripts which are used internal to the organization. Due to some standard changes, the server/system team has commented the below line from httpd.conf (apache config file) that support the CGI scripts. Because of this change, the existing CGI scripts are affected and unable to execute them on browser.

### LoadModule cgid_module modules/mod_cgid.so

Is there a way to overcome this situation and make the scripts work as is.

NOTE : The above commented line cannot be uncommented/enabled.

2

There are 2 answers

9
ikegami On

Ways of circumventing your company's policy, from best to worse:

  • Load mod_cgi anyway.

  • Load mod_fcgi, and convert your CGI script into a Fast CGI daemon. It's a lot of work, but you'll can get faster code out of it!

  • Load your own module that does exactly the same thing as mod_cgi. mod_cgi is open source, so it should be easy to just rename it.

  • Load mod_fcgi, and write a Fast CGI daemon that executes your script.

  • Install a second apache web server with mod_cgi enabled. Link to it directly or use mod_proxy on the original server.

  • Write your own web server. Link to it directly or use mod_proxy on the original server.

0
Dave Cross On

Last time you asked this question, you talked about using mod_perl instead. The standard way to run CGI program unchanged (for some value of "unchanged") under mod_perl is by using ModPerl::Registry. Did you try that? How did it go?

Another alternative would be to convert your programs to use PSGI. You could try using Plack::App::Wrap::CGI or CGI::Emulate::PSGI. Using Plack would free you from any deployment restrictions. You could run the code under mod-perl or even as a separate service behind a proxy server.

But I can't help marvelling at how ridiculous this whole situation is. Your company has CGI programs that it (presumably) relies on to run part of its business. And they've just decided to turn off support for them. You need to find out why this decision has been made and try to buy some time in order to convert to an alternative technology.