# apache install cgi's now download instead of execute(solved)

## iplayfast

/etc/conf.d/apache2 has

```
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D SUEXEC -D LANGUAGE -D USERDIR"

```

My 00_default_vhost.conf has

```

<IfDefine DEFAULT_VHOST>

Listen 80

<VirtualHost *:80>

        ServerName localhost

        Include /etc/apache2/vhosts.d/default_vhost.include

        <IfModule mpm_peruser_module>

                ServerEnvironment apache apache

        </IfModule>

</VirtualHost>

</IfDefine>

```

My default_vhost.include has

```

ServerAdmin root@localhost

# DocumentRoot: The directory out of which you will serve your

# documents. By default, all requests are taken from this directory, but

# symbolic links and aliases may be used to point to other locations.

#

# If you change this to something that isn't under /var/www then suexec

# will no longer work.

DocumentRoot "/var/www/localhost/htdocs"

# This should be changed to whatever you set DocumentRoot to.

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

        Options Indexes FollowSymLinks

        AllowOverride All

        Require all granted

</Directory>

<IfModule alias_module>

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

</IfModule>

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

        AllowOverride None

        Options None

        Require all granted

</Directory>

```

The site is:

/var/www/localhost/htdocs/chris->home/chris/public_html

and the page there accesses a cgi binary executable located in the cgi-bin directory at

/var/www/localhost/htdocs/chris->home/chris/public_html/cgi-bin

The cgi downloads instead of executing.  It used to work but I've done many upgrades since the last time I tried it, and something isn't configured right.

I'm sure it's something simple but I'm not seeing it. Please help.Last edited by iplayfast on Wed Apr 03, 2013 7:46 pm; edited 1 time in total

----------

## honp

You must add "-D CGI" to /etc/conf.d/apache to APACHE2_OPTS.

H.

----------

## iplayfast

That seemed to make no difference at all.

Doing a grep on CGI I found that the module 00_mod_mime.conf had a line

```

# To use CGI scripts outside of ScriptAliased directories:

# (You will also need to add "ExecCGI" to the "Options" directive.)

#AddHandler cgi-script .cgi

```

So I uncommented that, and it now gives a 403 forbidden error. 

Permissions look right. 

the error_log shows  that Options ExecCGI is off in this directory: /var/www/localhost/htdocs/chris/cgi-bin/file.cgi

How do I turn them on?

*** edit ***

Not stuck anymore, 

Added ExecCGI to the options in the default_vhost.include file.

Thanks for the help!

----------

