# FIXED: ScriptAlias broken since upgrade to Apache 2.2.15

## iterative

I recently upgraded to Apache 2.2.15 and seem to have broken ScriptAlias in the process (sorry, I'm not sure what version of Apache we were at before, but it was relatively recent).  I have two applications that use ScriptAlias: viewvc and mailman, and both are now broken.  I've tried tweaking the apache configuration and file permissions and haven't gotten anywhere.  Instead of running the scripts, apache just wants to return them as text files.

To isolate the problem and make sure that it wasn't something specific to either of the two applications, or to the virtual hosts they were running on, I copied the "hello world" CGI example from http://httpd.apache.org/docs/2.2/howto/cgi.html and dropped it into /var/www/localhost/cgi-bin/first.pl:

```
#!/usr/bin/perl

print "Content-type: text/html\n\n";

print "Hello, World.";

```

I believe the permissions are set correctly:

```
# ls -l  /var/www/localhost/cgi-bin/first.pl

-rwxr-xr-x 1 apache apache 77 Jul 19 19:08 /var/www/localhost/cgi-bin/first.pl*

```

and it runs just fine from the command line:

```
# /var/www/localhost/cgi-bin/first.pl

Content-type: text/html

Hello, World.

```

But when I open http://localhost/cgi-bin/first.pl in a browser, I see the contents of the script, not "Hello, World."

I can't see anything wrong with the apache config.  This is what I have in /etc/apache2/vhosts.d/default_vhost.include (with comments removed to save space):

```
DocumentRoot "/var/www/localhost/htdocs"

<Directory "/var/www/localhost/htdocs">

   Options FollowSymLinks

   AllowOverride All

   Order allow,deny

   Allow from all

</Directory>

<IfModule alias_module>

   ScriptAlias /cgi-bin/ "/var/www/localhost/cgi-bin/"

</IfModule>

<Directory "/var/www/localhost/cgi-bin">

   AllowOverride None

   Options None

   Order allow,deny

   Allow from all

</Directory>

```

When I try commenting out ScriptAlias and/or <Directory "/var/www/localhost/cgi-bin"> and restarting Apache, it stops serving up the contents of the file, so those seem to at least be doing something, just not what I want them to.

Anyone have any ideas on what I might be missing?

Thanks.Last edited by iterative on Tue Jul 20, 2010 9:30 pm; edited 1 time in total

----------

## Biker

Well, just a "meetoo" to say that you're not alone.

Please, post if you find the solution, because I'm searching all over the place without success.

Regards

Biker

----------

## iterative

Someone apparently thought it would be a good idea to disable mod_cgi, which was previously enabled by default, w/o warning:

https://bugs.gentoo.org/show_bug.cgi?id=328215

So obvious that I never even thought to check.  The fix was to add "cgi" to APACHE2_MODULES in /etc/make.conf and emerge apache again.

----------

## salfter

 *iterative wrote:*   

> Someone apparently thought it would be a good idea to disable mod_cgi, which was previously enabled by default, w/o warning:
> 
> https://bugs.gentoo.org/show_bug.cgi?id=328215
> 
> So obvious that I never even thought to check.  The fix was to add "cgi" to APACHE2_MODULES in /etc/make.conf and emerge apache again.

 

Did that, and Perl scripts are still broken.   :Crying or Very sad:    Since one of the websites I run uses Foswiki (which depends on Perl), this is a bit of a problem.  Other sites using PHP and ASP.NET (via Mono) work just fine, but my Foswiki installation is coming up 404.  Even a simple hello-world type of Perl script doesn't work when served up by Apache (though it works at the command line, so Perl itself isn't to blame).

----------

## jhaller

 *salfter wrote:*   

>  *iterative wrote:*   Someone apparently thought it would be a good idea to disable mod_cgi, which was previously enabled by default, w/o warning:
> 
> https://bugs.gentoo.org/show_bug.cgi?id=328215
> 
> So obvious that I never even thought to check.  The fix was to add "cgi" to APACHE2_MODULES in /etc/make.conf and emerge apache again. 
> ...

 

For those finding this topic from Google, add the following lines to your httpd.conf:

LoadModule cgi_module modules/mod_cgi.so

LoadModule cgid_module modules/mod_cgid.so

Better yet, follow the advice in the emerge output, and update the config files in /etc which need updating

Or, run etc-update

----------

