how to do a server side include for perl cgi /html

lurkmoar

Member
Mar 8, 2008
58
0
0
/var/www/html/housing/uapts
is where all my site's files are

/var/www/cgi-bin/housing/uapts/testing.cgi
is the cgi file i want to use


would i want to:
<!--#exec cgi="/var/www/cgi-bin/housing/uapts/testing.cgi"-->

or would it be something like
<!--#exec cgi=".../cgi-bin/housing/uapts/testing.cgi"-->
 

Onund

Senior member
Jul 19, 2007
287
0
0
I'm guessing you're running apache. In your site config file (usually: /etc/apache2/sites-available/<some config file> ) you can configure a 'ScriptAlias' directive, something like this:

ScriptAlias /cgi-bin/ /usr/bin/cgi-bin

So then in your html when you use /cgi-bin/someScript.pl apache will replace the cgi-bin part with your path. If you do a search for scriptalias on the apache site it should give you more details and info about configuring the <Directory ...> portion of the thing.

I'm not sure if your paths you provided will work because I think apache is already locking you down to a root you specify. So if you did:

<!--#exec cgi="/var/www/cgi-bin/housing/uapts/testing.cgi"-->

I think it will look in (depending on the config):
/var/www/html/housing/uapts/var/www/cgi-bin/housing/uapts/testing.cgi

Which is not what you want.
 

lurkmoar

Member
Mar 8, 2008
58
0
0
im pretty sure the file was /etc/httpd/conf/...

but your saying if i add:
ScriptAlias /cgi-bin/ /var/www/cgi-bin/housing/uapts/
to that file, ill be able to use:
<!--#exec cgi="cgi-bin/blah.cgi"-->

???
 

Onund

Senior member
Jul 19, 2007
287
0
0
Originally posted by: lurkmoar
im pretty sure the file was /etc/httpd/conf/...

but your saying if i add:
ScriptAlias /cgi-bin/ /var/www/cgi-bin/housing/uapts/
to that file, ill be able to use:
<!--#exec cgi="cgi-bin/blah.cgi"-->

???

I was saying do what meymrdj did, look up ScriptAlias at the apache site, but was too lazy to find the link for you. I was also trying to give you enough info to dig out the answers yourself so I can't be held responsible if you open some vulnerability on your server ;)

You might also need the leading / in your line:
<!--#exec cgi="/cgi-bin/blah.cgi"-->
 

lurkmoar

Member
Mar 8, 2008
58
0
0
ok, onund, if hypothetically the script alias path was /var/www/cgi-bin/x/

and the cgi file was /var/www/cgi-bin/x/y/file.cgi

then hypothetically the serverside call could be<!--#exec cgi="/y/file.cgi"-->
or /cgi-bin/x/y/file.cgi or something?

either way, the script alias is:

ScriptAlias /pl/ /var/www/cgi-bin/x/
<Location /pl>
Options +ExecCGI
</Location>

and it will take some work for me to change it.

meanwhile, my file is still in
/var/www/cgi-bin/x/y/(file.cgi)