# Apache CGI support



## balanga (May 28, 2016)

Can someone suggest how to enable CGI support in Apache24?

In httpd.conf there is:


```
<IfModule !mpm_prefork_module>
        #LoadModule cgid_module libexec/apache24/mod_cgid.so
</IfModule>
<IfModule mpm_prefork_module>
        #LoadModule cgi_module libexec/apache24/mod_cgi.so
</IfModule>
```

Should I uncomment both statements?


----------



## Oko (May 28, 2016)

balanga said:


> Can someone suggest how to enable CGI support in Apache24?
> 
> In httpd.conf there is:
> 
> ...


There are three different ways to run CGI in Apache24. If you uncomment 

```
<IfModule mpm_prefork_module>

        #LoadModule cgi_module libexec/apache24/mod_cgi.so

</IfModule>
```

you will use build in CGI module. You can also run CGI scripts using FastCGI or mod_perl. Each of these three different methods has pros and cons. If you are new to Perl you should stick with  CGI module and just uncomment the line I told you about.


----------



## balanga (May 29, 2016)

I have uncommented the lines in httpd.conf but the CGI scripts still don't run. I suspect it has something to do with permissions...


----------



## Oko (May 29, 2016)

If the permissions are OK but you see Perl scripts as a text files application can't find Perl on FreeBSD machine. Unfortunately these days lots of applications expect Ubuntu under the hood or at best Linux.Create symbolic links.


----------



## balanga (May 29, 2016)

I think there is something wrong with the permissions. I get a *Forbidden* error, rather than unformatted text.


----------



## lme@ (May 30, 2016)

Then you should check Apache's logfiles.


----------



## balanga (Jun 1, 2016)

It looks as though I have an Apache configuration problem...


```
[Wed Jun 01 14:50:59.281923 2016] [cgi:error] [pid 83966] [client 82.37.215.2
18:8745] AH02812: attempt to invoke directory as script: /usr/local/mailman/cgi-bin/
```


----------



## Oko (Jun 1, 2016)

balanga said:


> It looks as though I have an Apache configuration problem...
> 
> 
> ```
> ...



Mailman is a Python script. I thought we were troubleshooting Perl. Personally for Python I use uWSGI and Nginx. I have never used Python on Apache. The only reason I got into discussion was that I recently set Foswiki which is true Perl application on FreeBSD so my memory was still fresh.


----------

