Link to home
Start Free TrialLog in
Avatar of Neo
NeoFlag for Cyprus

asked on

CGI script error

Hello,

A cgi script that was functioning properly when accessed via IP address, is currently not working when accessed via domain name (now that the nameservers have propagated.)
Instead it is producing a message to open or save the cgi file.

I have checked the scripts in cgi-bin and the permissions are all correct 755.

Thanks for your help.
Avatar of Jim Riddles
Jim Riddles
Flag of United States of America image

What web server are you using, Apache, IIS, etc...?
Avatar of Neo

ASKER

Apache
ASKER CERTIFIED SOLUTION
Avatar of Jim Riddles
Jim Riddles
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Neo

ASKER

thanks i will pass this on to support
Centos7
Hi netplus,
That open/save behaviour is what I get when I don't have this line in my .htaccess file:
AddHandler cgi-script .pl .cgi .pm

Open in new window

You probably don't need to list all those 3 extentions though.  You can just list the one(s) which your CGI scripts use.
I understand this can also be done at the (more global and probably more efficient) Apache config level, which is where I think Jim is suggesting you make his change.
But I have no idea why getting the domain name working would change this behaviour, so I could easily be wrong.  Maybe the domain name was not the only thing that changed at that time?

Hi Jim,
It seems to have worked for netplus before the domain name was in place, so any ideas why it would have stopped working when the domain was put in place?
Avatar of Neo

ASKER

Hi and thanks very much for your help Jim and tel2

The script started to work  after commenting out the following line in /usr/local/apache/conf/mime.types and restarting apache:

#application/cgi cgi
The reason it may have worked before is that there is likely a different section in the conf file, or a different conf file altogether, that defines access by IP address rather than by name.  It is not uncommon, as most people who host different sites on the same server would rather display a generic message like "Site not found" if someone tries to access the site by IP address.