Welcome to WebmasterWorld Guest from 54.161.118.57

Forum Moderators: coopster & jatar k & phranque

Message Too Old, No Replies

using ssi to call cgi on subdomains

calling cgi script via ssi in subdomains

     
9:03 pm on Feb 29, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 29, 2004
posts:41
votes: 0


Is it possible to run cgi scripts via ssi in subdomains, if the script is installed in the root directory?

I have a cgi script installed in my main cgi-bin. And I can run the script by directly linking to the script (www.mydomain.com/cgi-bin/script.cgi). And I can call the script via ssi on all my .shtml pages that aren't in a subdomain. But when it comes to my subdomains, I get the error message: an error occurred while processing this directive. To call the script I'm using: <!--#include virtual="/cgi-bin/b3fmail/b3fmail.cgi?action=getform&form=test" -->

12:42 am on Mar 3, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 22, 2004
posts:59
votes: 0


I haven't tried this, but I think it should work.
Try
<!--#include virtual="../cgi-bin/b3fmail/b3fmail.cgi?action=getform&form=test" -->

assuming the subdomain directory is at the same level as the cgi-bin directory for the main site (usually a good assumption).

2:36 am on Mar 3, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 29, 2004
posts:41
votes: 0


Thank you; your code works...sometimes.

To get to the page where I've placed the code, if I type the url as www.mydomain.com/subdomain/file.shtml everything works fine. But when I type it as www.subdomain.mydomain.com/file.shtml I get the same error message as before (everything else on the page is fine though).

Shouldn't both urls work the same and lead to the same place?

6:00 pm on Mar 3, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 22, 2004
posts:59
votes: 0


try subdomain.mydomain.com/file.shtml instead of www.subdomain.mydomain.com/file.shtml.
4:15 am on Mar 4, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 29, 2004
posts:41
votes: 0


no success.

only the www.mydomain.com/subdomain/file.shtml shows the script correctly.

12:42 pm on Mar 6, 2004 (gmt 0)

Preferred Member

10+ Year Member

joined:Dec 19, 2000
posts:366
votes: 0


You could define the cgi-bin of your subdomains to be the same as the cgi-bin of your root domain.
On Apache this can be done in http.conf with a configuration like this for example:

## the root domain
ServerName www.domain.com
DocumentRoot /home/domain/html

# the subdomain
ServerName sub.domain.com
DocumentRoot /home/domain/sub/html
ScriptAlias /cgi-bin /home/domain/cgi-bin/

See [httpd.apache.org...] for more info.

8:46 pm on Mar 12, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 29, 2004
posts:41
votes: 0


Not sure where http.conf is on my server; so asking my server and will try out your suggestion as soon as they reply.

Another question:
Every time I use a file manager to edit the page with the ssi script, it keeps adding amp; to the script. It starts looking something like below

<!--#include virtual="../cgi-bin/b3fmail/b3fmail.cgi?action=getform&amp;amp;amp;amp;amp;form=test" -->

I have to keep deleting each amp; or else the script won't work. Why does amp; keep inserting itself?

9:06 pm on Mar 12, 2004 (gmt 0)

Preferred Member

10+ Year Member

joined:Dec 19, 2000
posts:366
votes: 0


Sorry, http.conf should be httpd.conf

The amp; thing sounds like a bug (programming mistake) in your file manager to me. Maybe you can ask the programmer who wrote it to look at the problem?

10:55 pm on Mar 13, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 29, 2004
posts:41
votes: 0


My server says I don't have an httpd.conf file because it is a server file. They suggest I try to use http.access instead.
2:17 am on Mar 19, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 29, 2004
posts:41
votes: 0


I'm lost. I've never done configurations before. Can someone explain to me how to write a script alias? What do I put where?
9:39 am on Mar 19, 2004 (gmt 0)

Preferred Member

10+ Year Member

joined:Dec 19, 2000
posts:366
votes: 0


>use http.access instead.
That should be .htaccess

The file has no name, just the extension htaccess
Glad I'm not the only one who mixes up filenames :)

I have never tried this in .htaccess (only in httpd.conf) but I think the following should work.
This one line idea assumes that your subdomains have been configured elsewhere for the rest, and your server does indeed support mod_alias.

Create a file in a text editor called .htaccess and add only the following line to it:

ScriptAlias /cgi-bin /home/domain/cgi-bin/

Where "/home/domain/cgi-bin/" is the path to the cgi-bin of the main domain

Upload the .htaccess file to the html root of your subdomain. If it has worked you can now use the same virtual includes on your main domain and on the subdomain (with the same path to the script).

6:07 pm on Mar 19, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 29, 2004
posts:41
votes: 0


Okay, I've created a .htaccess file in one of my subdomains and put in the code, but I'm getting an internal server error. What could be wrong? How do I check that my subdomains are configured right?